In how many ways and places we can place comment in CSS?

你离开我真会死。 提交于 2019-12-12 07:02:00

问题


  • In how many ways and places we can place comment in CSS?
  • Can placement of comment can creat any problem in css rendering and validation?
  • How to show comment in Firebug?
  • How to write good comment for big and small changes in CSS
  • How to CSS readable, clear from comment for easier management

回答1:


The CSS specification spells this out definitively:

Comments begin with the characters /* and end with the characters */. They may occur anywhere between tokens, and their contents have no influence on the rendering. Comments may not be nested.

CSS also allows the SGML comment delimiters (<!-- and -->) in certain places defined by the grammar, but they do not delimit CSS comments. They are permitted so that style rules appearing in an HTML source document (in the STYLE element) may be hidden from pre-HTML 3.2 user agents. See the HTML 4 specification ([HTML4]) for more information.

For example:

.row {background-color:#FFF;}  /* normal */
.row:hover {background-color:#CCC; /* grayed background */}

/* the title class */
.title{
    /* make font bigger */
    font-size: 160%;
}



回答2:


Well, you can use the /* and */ syntax for block comments.




回答3:


The only kinds of comments allowed in CSS are the /* ... */ block delimiters. They can be placed almost anywhere, as if you were using them in any other language (that uses those kinds of comments, of course).



来源:https://stackoverflow.com/questions/2391223/in-how-many-ways-and-places-we-can-place-comment-in-css

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!