RobG said:
The OP has been offered two options,
No, there have been more, including mine that it is far better just
to let it be. Which applies especially to that field of application:
Customers that are provided _nothing_ (from their point of view) will
leave almost immediately, before the content _perhaps_ would be
displayed later.
this is one. It 'works' exactly as requested as far as I can see - it will
almost certainly ensure that the div is marked to be hidden before its
HTML is parsed. It also means that if scripting is disabled, both divs
will be shown.
And now try to show that `div' element again or just try to make the
document usable without client-side script _and_ CSS-DOM support --
surprise!
Know your CSS, but also know your CSS-DOM: using the `style' property of an
element object -- which would be necessary as Opera provides no means of
accessing style rules -- is equivalent to using the `style' attribute of
the element it represents. Although CSS defines that the specificity of
declarations in the `style' attribute of an element is the same as a style
rule with an ID selector, --
| In HTML, values of an element's "style" attribute are style sheet rules.
| These rules have no selectors, but for the purpose of step 3 of the
| cascade algorithm, they are considered to have an ID selector
| (specificity: a=1, b=0, c=0).
and
| 3. The secondary sort is by specificity of selector: more specific
| selectors will override more general ones. Pseudo-elements and
| pseudo-classes are counted as normal elements and classes,
| respectively.
-- not all UAs also honor cascading step 4 that says
| 4. Finally, sort by order specified: if two rules have the same weight,
| origin and specificity, the latter specified wins. Rules in imported
| style sheets are considered to be before any rules in the style sheet
| itself.
IIRC we had cases here proving that especially IE is broken in that regard,
and I know from personal experience that with IE often the first match wins,
not the last match. OK, you can access stylesheet rules with IE's CSS-DOM
and so could change the ID rule. But, come on, all this effort for a
really misguided and harmful "solution", efforts that will inevitably only
make a Bad Thing worse?
HTH
PointedEars