Comments In CSS– How To Code It

This article relays relevant information on comments in CSS, their general use, benefits, and how to create them.

A CSS comment is a series of codes in the CSS programming language presenting data in relation to the text to momentarily render a section inoperative, or to elicit opinions from other coders. Comments in CSS permit you to encode without undergoing interpretation from the rendering browser.

Benefits Of CSS Comments

Comments in CSS are utilized to explicate and clarify further concerns regarding difficult codes, inform other web and code developers about the progress relating to that page, supply particulars on the date and time the code was edited or evaluated, conceal sections of the webpage that are still in progress, and elucidate complex figures and other forms of data structures. Comments in CSS also enable easier transfer of a series of codes from one member of the team to another, and help members of the quality assurance committee to check the code for the reason that they would know what the coder intends to render – despite the outcome not achieved.

Comments in CSS are also used to make editions of your code at another date and time. Despite being the sole person responsible for webpage maintenance, you will not have too many inconveniences in remembering the structure at which you have built a certain code since it already gives details. Comments in CSS can also be used to identify the start and finish of a certain block, task and segment.

Furthermore, if a problem exists in the CSS layout, you can comment on bigger/current parts of the code until the root of the problem has been identified. Comments in CSS also allow the webpage developer to contain data in the document about the technicalities and uses of the page. This data is not only limited to the person responsible for coding, date edited, and the changed material.

How To Make A CSS Comment

In CSS commenting, the process begins with this symbol /* and finishes with */. These CSS comments can be long, consuming several lines, but may not be nested:

/*This is an example of a single line comment*/

/* This is an example

of a comment that

takes several lines */


In the new specification of CSS2, comments that show among tokens will not have any consequence on the styles rendering. However, there are some instances wherein rendering errors are uncommon, especially in some older versions of web browsers. In CSS, comments can contain some elements that you don’t like to exist in the directory but you don’t want to remove either.