CSS注释
就像HTML教程中描述的一样,在CSS文档中注释也起到很重要的作用,可以帮助我们记起CSS的含义,加载在HTML文档的位置等.
CSS注释的开始使用/*,结束使用*/
CSS注释语法
CSS Code复制内容到剪贴板
/* 注释内容 */
示例
/* ———-文字样式开始———- */
/* 梦之都白色12象素文字 */
.dreamduwhite12px
{
color:white;
font-size:12px;
}
/* 梦之都黑色16象素文字 */
.dreamdublack16px
{
color:black;
font-size:16px;
}
/* ———-文字样式结束———- */
风格建议
我使用行宽不超过 80 字节的文档块风格注释:
CSS Code复制内容到剪贴板
/**
* This is a docBlock style comment
*
* This is a longer description of the comment, describing the code in more
* detail. We limit these lines to a maximum of 80 characters in length.
*
* We can have markup in the comments, and are encouraged to do so:
*
<div class=foo>
<p>Lorem</p>
</div>
*
* We do not prefix lines of code with an asterisk as to do so would inhibit
* copy and paste.
*/
/**
* 这是一个文档块(DocBlock)风格的注释。
*
* 这里开始是描述更详细、篇幅更长的注释正文。当然,我们要把行宽控制在 80 字节以内。
*
* 我们可以在注释中嵌入 HTML 标记,而且这也是个不错的办法:
*
<div class=foo>
<p>Lorem</p>
</div>
*
* 如果是注释内嵌的标记的话,在它前面不加星号,以免被复制进去。
新闻热点
疑难解答