Johnny Chen
Johnny Chen

Reputation: 2070

Why is CSS part commented in some html pages?

I just read this code , and I'm not sure what's the point of doing this.

<head>
<style type="text/css">
<!--
h{
    color : blue;
}
-->
</style>
</head>

What is the comment symbol <!-- --> trying to do here since the CSS does take effect anyway?

Upvotes: 3

Views: 52

Answers (1)

Quentin
Quentin

Reputation: 944171

To stop very old browsers (such as Netscape 1) that do not recognise the <style> tag from rendering the text inside the element.

The technique became pointless when the marketshare of those browsers dropped to "as close to zero as makes no difference" sometime in the 1990s.

Upvotes: 7

Related Questions