tags:

views:

74

answers:

3

Hello!

I have a div that I use to display alerts when needed.

If I want to close it after a while can I use display:none or should I use display:none as well as visibility:hidden?

So one or both.

Thank you.

+6  A: 

Depends. If you need the space to be left blank, that is, the space won't be taken up by other elements below or around it, you'll need visibility: hidden. Otherwise, use display: none, which will allow other elements to move into the element's place.

There's no reason to use both.

Yi Jiang
+1  A: 

Visibility:hidden hides the element but it still takes up space in the layout. Display:none removes it completely.

In your case, I would use Display:none

Chuck
there is no display:hidden, there is visibility:hidden :)
Sotiris
That's what I get for typing before coffee! Thanks for the catch, I updated my post. :)
Chuck
A: 
Mike