CSS comments are not displayed in the browser, but they can help docu
Comments are used to explain the code, and may help when you edit the source code at a later date.
Comments are ignored by browsers.
A CSS comment is placed inside the <style> element, and starts with /* and ends with */:
External styles are defined within the element, inside the
section of an HTML page:
<!DOCTYPE html>
<html>
<head>
/* This is a single-line comment */
p {
color: red;
}
</head>
<body>
<p>ACADEMY OF INFORMATION TECHNOLOGY!</h1>
<p>This paragraph is styled with CSS.</p>
<p>CSS comments are not shown in the output.</p>
</body>
</html>
ACADEMY OF INFORMATION TECHNOLOGY!
This paragraph is styled with CSS.
CSS comments are not shown in the output.
You can add comments wherever you want in the code:
External styles are defined within the element, inside the
section of an HTML page:
<!DOCTYPE html>
<html>
<head>
p {
color: red; /* Set text color to red */
}
</head>
<body>
<p>ACADEMY OF INFORMATION TECHNOLOGY!</h1>
<p>This paragraph is styled with CSS.</p>
<p>CSS comments are not shown in the output.</p>
</body>
</html>
ACADEMY OF INFORMATION TECHNOLOGY!
This paragraph is styled with CSS.
CSS comments are not shown in the output.
Even in the middle of a code line:
External styles are defined within the element, inside the
section of an HTML page:
<!DOCTYPE html>
<html>
<head>
p {
color: /*red*/blue;
}
</head>
<body>
<p>ACADEMY OF INFORMATION TECHNOLOGY!</h1>
<p>This paragraph is styled with CSS.</p>
<p>CSS comments are not shown in the output.</p>
</body>
</html>
ACADEMY OF INFORMATION TECHNOLOGY!
This paragraph is styled with CSS.
CSS comments are not shown in the output.