+3 votes
82 views
in Tips & Tricks by (242k points)
reopened
CSS: insert a comment

1 Answer

+4 votes
by (1.6m points)
 
Best answer

How to insert comments in CSS


A comment is ignored by the browser and offers space for your own notes. Read here how this works in CSS..

image image

In CSS, just like in programming languages, comments are annotations that contain information for the text editor. In this way, a comment can be made within your CSS file to explain the respective rule set for other users. You can find out how to insert comments in CSS in this post.

How to insert comments in CSS

Like HTML, CSS is not a programming language per se, but a stylesheet language that allows the behavior and appearance of individual elements on the page to be determined. If you would like to explain your settings in CSS for other readers or for yourself, it is a good idea to write comments. To insert a comment in CSS, all you need is the / * character at the beginning and the * / character to close the comment .

Note that contrary to other programming languages ​​in CSS, a single-line comment with, for example, a hash # is not possible. Here the comment must always be enclosed with / * and * / . Of course, you can also create multiline comments this way..

An example in CSS:

/* Änderung der Hintergrundfarbe für
die gesamte Website */

html {

background-color: #00539F;

}

image
To explain the following settings, a note in the form of a comment can be inserted in CSS.


...