Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is CSS part commented in some html pages?

Tags:

html

css

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?

like image 541
Johnny Chen Avatar asked Dec 20 '25 23:12

Johnny Chen


1 Answers

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.

like image 143
Quentin Avatar answered Dec 23 '25 15:12

Quentin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!