CSS 注释
最后一次修改 2017年08月04日
CSS 注释
注释用于解释您的代码,它们被浏览器忽略。
CSS注释以“ /* ”开头,以“ */ ”结尾,例如:
/*This is a comment*/
p{
color:red;
text-align:center;
}例子
以下代码在html文档中使用CSS注释。
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
/*This is a comment*/
p{
color:red;
text-align:center;
}
</style>
</head>
<body>
<p>Visit the website</p>
</body>
</html>例2
我们甚至可以在声明中使用注释。
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
p{
color:red;
/*This is a comment*/
text-align:center;
}
</style>
</head>
<body>
<p>Visit the website</p>
</body>
</html>← CSS 语法

