CSS · CSS Tutorial · Lesson 5
CSS Comments
Explain your CSS with comments.
Comments explain the code and may help when you edit the source later. They are ignored by browsers. A CSS comment starts with /* and ends with */.
Example
<style>
/* This is a single-line comment */
p {
color: red; /* Set text color to red */
}
/* This is
a multi-line
comment */
</style>
<p>Hello World!</p>
Tip: CSS has no
// single-line comments — always use /* */.Keep reading “CSS Comments”
Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.