- From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
- Date: Sat, 20 Aug 2005 18:58:39 +1000
- To: Martin Vičánek <M.Vicanek@seznam.cz>
- CC: www-validator@w3.org
Martin Vičánek wrote:
> Why is not this code valid?
>
> <SCRIPT type="text/javascript">
>
> if (navigator.appName != 'Microsoft Internet Explorer')
> document.write ("<style>#menu LI.main A {display : block}</style>");
>
> </SCRIPT>
>
> Error Line 134 column 65: end tag for element "STYLE" which is not open.
This explains why it's invalid.
http://www.htmlhelp.com/tools/validator/problems.html#script
A better solution for your needs is to use a CSS hack or a conditional
comment. However, the best solution would be to find some CSS that
works the same for all browsers, and only resort to the use of a hack if
abolutely necessary.
This will apply only to Internet Explorer. However, it will apply to
both IE5/Mac and IE/Win.
* html #menu LI.main A {display : block}
If you only need it to apply to IE/Win, then add this comment hack
around it.
/* Hide from IE5/Mac \*/
* html #menu LI.main A {display : block}
/* End Hiding */
--
Lachlan Hunt
http://lachy.id.au/
Received on Saturday, 20 August 2005 08:58:48 UTC