CSS Comments

CSS Tutorial

CSS Advanced

CSS Responsive

CSS Grid

CSS Comments

CSS comments are not shown in the browser, but they help document the source code.

Comments help to explain the code and are useful while editing the source code at a later date

Comments are ignored by browsers.

A CSS comment is written within the:

start /* This is comment */ end

<!DOCTYPE html>
<html>
<head>
<style>
/* This is comment */
p {
color: red; /* Set text color to red */
}
</style>
</head>
<body>
<p>Hello World!</p>
<p>This paragraph is styled with CSS.</p>
<p>CSS comments are not shown in the output.</p>
</body>
</html>

HTML and CSS Comments

In the below example, we use a combination of HTML and CSS comments:

<!DOCTYPE html>
<html>
<head>
<style>
/* This is comment */
p {
color: red; /* Set text color to red */
}
</style>
</head>
<body>
<p>Hello World!</p>
<p>This paragraph is styled with CSS.</p>

<!– These paragraphs will be red –>

<p>CSS comments are not shown in the output.</p>
</body>
</html>