CSS comments are the most important property when you explain your written code to the users.

Comments are not displayed in browsers.

You will put CSS comments  inside the <style> element or tags.

The comments are single or multiple lines, starts with /* and ends with */. 

Example : Single-line CSS comment

<!DOCTYPE html>
<html>
<head>
<style>
/* This is a single-line comment */

h2 {
  color: green;
}
</style>
</head>
<body>

<h2>There are many types of heading</h2> 
<p>Today we learn, how to add CSS</p>

</body>
</html> 

 

Example : Multi-line CSS comment

<!DOCTYPE html>
<html>
<head>
<style>
/* This is
a multi-line
comment */

h2 {
  color: green;
}
</style>
</head>
<body>

<h2>There are many types of heading</h2> 
<p>Today we learn, how to add CSS</p>

</body>
</html> 

Pin It on Pinterest

Shares
Share This