CSS Comment
What is Comment in CSS?
comments are the method which is aimed to illustrate situations which are complex enough, or that require explanations within your code.
This information will not appear on the site's webpage but can be seen in the source code.
How you can add comments in CSS:
/* This is a single-line comment */
/*
This is a multi-line comment.
You can write multiple lines here.
*/
The commenting system finds its usage when the characters in one comment till the end of the line is indicated by the (/* and /*).
Statement "/* String refers to any text in the following line and blank space is optional */" means that no line break is relevant for purpose of comments.
Here's a practical example:
/* Styles for the header */
header {
background-color: #333;
color: white;
padding: 10px;
}
/* Styles for the main content */
.main-content {
width: 80%;
margin: 0 auto;
}
/*
Responsive styles for smaller screens
Adjust the layout for mobile devices
*/
@media screen and (max-width: 600px) {
.main-content {
width: 100%;
}
}
The CSS part of the code in this snippet is commented out for a better understanding of the blocks of code rules.
If this in the future someone else have to do something with that code than it will be easier for him.