Comments in CSS are typically used to explain the purpose of the style rules declarations. It will help you and others to understand what you were trying to do with the style rules at the time of editing style sheets. Comments are not displayed by the browsers.
A CSS comment begins with /*, and ends with */. Here's an example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Comments in CSS</title>
<style>
/* This is a single line CSS comment */
/* This is an example of a
CSS multi-line comment */
body {
font-family: Arial, sans-serif;
}
p {
color: #333;
line-height: 1.5;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam eu sem tempor, varius quam at, luctus dui. Mauris magna metus, dapibus nec turpis vel, semper malesuada ante. Vestibulum id metus ac nisl bibendum scelerisque non non purus. Suspendisse varius nibh non aliquet sagittis. In tincidunt orci sit amet elementum vestibulum.</p>
</body>
</html>
Use the Syntax
"/* text */"
Comments in CSS are typically used to explain the purpose of the style rules declarations. It will help you and others to understand what you were trying to do with the style rules at the time of editing style sheets. Comments are not displayed by the browsers.
A CSS comment begins with
need an explanation for this answer? contact us directly to get an explanation for this answer/*
, and ends with*/
. Here's an example: