Forum Bugs

Are CSS comments legal in style blocks?

cmillard
Is this legal?

<html>
<head>
<style>
/* 
Example code: <div> </div>
*/
</style>
</head>
<body>
...
</body>
</html>


We render our documents dynamically. I've got a CSS document which is pulled into the <style> block of some dynamic content, and I end up with something similar to the code above.

Prince has an issue with the <div> tag in the comment:
error: Unexpected end tag : div

Everything seems to be working as expected, but I thought I'd mention it.

Cheers,
Chris
mikeday
That's actually a tricky question, as it depends whether you are using XHTML or HTML, and various other things. In general it's probably better not to put things that look like tags in style elements, just to be on the safe side.