I need to know what value/ css would be set when I use display: initial
on non CSS3 compliant browsers ?
I'm hiding the class using display:none
& need to show back, for which I intend to use display: initial
(I dont want to use display:block
if previously it was display:inline
) but the hidden element must be shown on all browsers.
What happens by CSS 2.1 rules on error handling as well as in practice is that the declaration display: initial
is ignored, without affecting the rest of the style sheet. The display
property thus gets its value from other rules. In the absence of any setting on it in any style sheet (including browser default style sheet), the initial value inline
is used.
The “fallback” code in the edit of your question means that the value of display
would be inline
in browsers that support the value inline
, and block
in other browsers. This does not sound safe.
The value initial
does not mean “the previous value set in a style sheet” or anything like that, as the question seems to postulate. Instead, it means the value that is designated as the property’s initial value in CSS specifications. For display
, this is inline
.
Ok, I found that providing a fallback would be a safer option. So I use like below:
{
display: block;// just as fallback
display: initial;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With