[vox-tech] dumb html question

Matt Roper vox-tech@lists.lugod.org
Thu, 13 Dec 2001 13:08:17 -0800


I seem to recall that CSS (and JavaScript also) have two comment
markers:  "<!--" and "//".  Both of these markers are only active until
the end of the line, the same way "#" works in shell scripts.  I think
the problem with your first example is that <!-- kills everything on its
line, so your STYLE tag really is empty (it only contains a comment).
The problem with the second example is that "-->" has no meaning in CSS
(it isn't an end of comment marker like it is in HTML) so the ">" at the
end is getting interpreted strangely.  What you want is:

<STYLE type="text/css">
    <!--
    H1 {font-size: +33pt}
    // -->
</STYLE>

Now the first and third lines inside the STYLE tag are comments as far
as CSS browsers are concerned.  Old browsers that don't understand CSS
will simply think the whole thing is an HTML comment.  Note that a CSS
capable browser would accept

<STYLE type="text/css">
    <!--
    H1 {font-size: +33pt}
    //
</STYLE>

just fine.  The "-->" is only there to help old browsers.

Of course it's been a while since I looked at this type of stuff, so I
may be completely wrong here...


Matt

On Thu, Dec 13, 2001 at 12:04:47PM -0800, Peter Jay Salzman wrote:
> weblint complains that <STYLE> is empty:
> 
> 	<STYLE type="text/css">
> 		<!-- H1 {font-size: +33pt} -->
> 	</STYLE>
> 
> weblint complains that "< should be written as &lt;":
> 
> 	<STYLE type="text/css">
> 		<!--
> 		H1 {font-size: +33pt}
> 		-->
> 	</STYLE>
> 
> someone help me out here.  what's the correct form?  both work on netscape
> 4.x and opera.   but i'd like for this to weblint clean if possible.
> 
> pete
> 
> 
> -- 
>                ** Please don't send me html email **
> PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D
> PGP Public Key:  finger p@dirac.org
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech

-- 

*************************************************
* Matt Roper <matt@mattrope.com>                *
* http://www.mattrope.com                       *
* PGP Key: http://www.mattrope.com/mattrope.asc *
*************************************************