CSS 注释
2020-08-10 09:30 更新
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;
text-align:center;
}*/
</style>
</head>
<body>
<p>Visit the website</p>
</body>
</html>
以上内容是否对您有帮助:
← CSS 语法

免费 AI IDE


更多建议: