David Dorward wrote:
Harlan Messinger wrote:
I made a site with validated XHTML and CSS.
Try
<style type="text/css" media="screen">
<!--
@import "styles/site.css";
-->
</style>
Not in XHTML!
Either:
<style type="text/css" media="screen">
@import "styles/site.css";
</style>
or
<style type="text/css" media="screen"><!--/*--><![CDATA[/*><!--*/
@import "styles/site.css";
/*]]>*/--><!]]></style>
XHTML 1.0 Appendix C states:
Script and Style element contents must be wrapped within a CDATA
marked section
to avoid expansion of entities < and & as start of markup and not to
recognize
< and & as < and & respectively.
<script> || <style>
<![CDATA[
... unescaped script or style content ...
]]>
</script> || </style>
An alternative is to use external script and style documents.
For compatibility with existing HTML 4 user agents, it goes on to say to use
external style sheets or external script if either uses < or & or ]]> or --.
It further notes that the historical practice of hiding scripts and
style sheets
within _comments_ for backward comptibility is likely to not work as
expected.
Ian Hickson expands on this by showing how to use _js/css comments_ with:
<script type="text/javascript"><!--//--><![CDATA[//><!--
...
//--><!]]></script>
and
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
...
/*]]>*/--></style>
which are not necessary if following Appendix C conformance and
compatibility
guidelines unless _comments_ are absolutely necessary, which are not IMHO.
--
Gus