The most crucial yet ignored part of code (in any language across all development platforms) is the comments. Comments do not contribute to the actual compilation and execution of the code; instead, they serve as flags throughout the file that help you to navigate and understand the code.
Imagine your code as the street and the comments as street signs!
There are essentially three ways you can comment in a CSS file:
Comments in the CSS file are encapsulated in-between /*
and */
.
You can concatenate the start and end of your comment with /*
and */
in the same line.
/*outside class single line comment*/
.my-class {
/*inside class single line comment*/
...;
...;
...;
}
/*
outside class
multiple line
comment
*/
.my-class {
/*
inside class
multiple line
comment
*/
...;
...;
...;
}
Put /*
a line above your multiple-line comment and */
below it.
Encapsulate your styling class by putting /*
above your class and */
below it.
.my-class {
...;
...;
...;
}
/*
.commented-class {
...;
...;
...;
}
*/
Free Resources