Reputation: 1491
I understand style="display: none"
hides an HTML element, and style="display: block"
displays a block-level HTML element.
I saw some historic code using style="display: "
, which also displays the element.
What's the difference between style="display: block"
and style="display: "
?
Upvotes: 0
Views: 97
Reputation: 943185
style="display: "
is invalid. The attempt to set the property will be ignored. The value of display
will be taken from the cascade instead.
That might mean it will take the browser default value for display
for the element type, or it might take the value from a ruleset in the stylesheet.
You can get the same effect with style=""
without being invalid.
Upvotes: 1
Reputation: 18113
The difference is that style="display: "
does nothing, since there isn't a value defined and therefor invalid.
So the element will be displayed (by default).
Please note that display
also accepts other values that also will display the elements, but will render them differently. More info about that here: https://developer.mozilla.org/en-US/docs/Web/CSS/display
Upvotes: 4