0

I have created a small tooltip test using a div with an input and p. However, when I try and increase the opacity so that the tooltip effectively fades in and out, something seems to go wrong. I've tried this on Firefox & Chrome so far and can't figure out what the problem is.

FIDDLE: http://jsfiddle.net/2vsts8fv/

2 Answers 2

1

That's because of the display: none property, which applies immediately.

As an alternative, you can use visibility to hide your item, which also plays along well with transitions:

p.tip {
    display: inline;
    visibility: hidden;
    transition: opacity 1s, visibility 1s;
}
div.tooltip:hover > p.tip {
    visibility: visible;
    opacity: 1;
}

JSFiddle

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Cedric! I've always steered clear of visibility personally as it still takes up space and can be accessed, for that reason I'd always use display: none but I think in this instance, visibility is probably best! Thanks again!
1

That is because you are using display: none. Try visibility: hidden and give a better position through CSS.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.