Jump to content

strange doubt on display and hide an element


yaragallamurali

Recommended Posts

hi.

To hide an element i am setting display property to "none" and to display it again i am just removing "none" that means i am setting display property to ""(empty) using java script and my element get displayed so why should i use "block" then and what is the use of it?

Link to comment
Share on other sites

When setting it to an empty value, you're telling it to use the value given to it by the stylesheet or if the stylesheet is empty, the browser's default value.

 

You would need to specify "block" or "inline" if the stylesheet had it set to "none" by default.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...