Comments

Comments

Comments are used to add explanatory notes or prevent the browser from interpreting parts of the style sheet.

Comments can be placed where ever white space is allowed within a style sheet.

Syntax

/* Comment */

Examples

/* A single line comment */

/*
A comment
which stretches
over several
lines
*/

Notes

The /* */ comment syntax is used for both single and multi line comments. There is no other way to specify comments in external style sheets. However, when using the <style> element, you may use <!-- --> to hide CSS from older browsers, although this is not recommended. As in most programming languages that use the /* */ comment syntax, comments cannot be nested. In other words, the first instance of */ that follows an instance of /* closes the comment.

Specifications

See also

© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Comments

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部