How to write CSS comments

 Most programming languages ​​have the function of annotations. Of course, it is to write the meaning of each paragraph in the program. It will be easier to maintain in the future. CSS is no exception, and CSS annotations are divided into single-line annotations. Unlike multi-line comments, the following examples use these two writing methods respectively.


Example of writing single-line CSS comments
<style type="text/css">
 // This is a single-line comment
 // This is a single-line comment
</style>
Single-line comments use two slashes //. The text after // is regarded as a comment and cannot be wrapped. It is usually used to annotate a single CSS property. If a single-line comment is used on many lines at a time, the effect is also Similar to multi-line comments, it just has to be written many times. If there are many codes to be annotated at one time, you can use the built-in CSS multi-line annotation function.

Example of writing multi-line CSS comments
<style type="text/css">
 /*
 This is a multi-line comment
 This is a multi-line comment
 */
 ...
</style>
Multi-line comments use /* and */ to wrap the comment text. There can be many lines. Generally speaking, multi-line comments can be used to write a whole paragraph of description or CSS Code introduction. CSS selectors are wrapped and annotated, which can be said to be a rare good technique for adjusting CSS syntax.

Post a Comment

0 Comments