Saturday, 31 August 2013

JavaScript->CSS: display="";?

JavaScript->CSS: display="";?

In JavaScript, one can set the default display of an element by using the
following code outline:
whateverElement.style.display="";
If whateverElement's display was "none" when this code was run, it will
now be whatever it would be naturally, according to the browser's default
rendering.
If whateverElement was a DIV with no previous matched CSS rules that
define its display, when it's JavaScript display property is set to ""
(blank), its display would be defaulted to its natural, which is "block".
My problem is that I wish to use CSS3 animations by assigning a class to
them through JavaScript, some animations that make it necessary to know
the natural display of the element.
In Google Chrome Canary, I'm noticing that the display property "auto" is
non-existent.
Is there another way in which I can create CSS3 animations where I set the
display property to the "default" or "auto" display of an element?
Some examples...
div{display:inline;} //all divs to be displayed "inline"
div#specific{display:auto;} //#specific to be displayed BLOCK,
disregarding the previous CSS rule.

No comments:

Post a Comment