开发者

What is the usage of comment notations in style tag?

For example :

<style type="text/css">
    <!--
    #map{ width:500px;height:500px;float:left }
    -->
</style>

Wha开发者_JAVA技巧t is the usage of <!-- --> ?


It stops Netscape 2 era browsers, which don't recognize the <style> element, from rendering the content as text (since they start to render the content, but it is a comment, so it isn't rendered).

This is described in the HTML specification.

Entirely worthless today, but people keep adding them without understanding them in a cargo cult mentality.


I only use that type of comment for mock up when I want to remember my reasoning behind a certain structure of elements or have something I want to remember to add later. I never use those comments in production webpages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜