CSS Comments


Go to main Page

Comments in CSS

Comments are ignored by browser.

Comments are used to explain the code and comments help in editing the source code.

In CSS comments are written between /*comment*/.

Example


/* styling p tag */
p{
    color:green;
    text-align:center;
    background-color:orange; /* applying background color */
}
  

  


HTML and CSS Comments

We can use HTML and CSS comments togather.

Example


<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <style>
        /* styling h tag */
h1{
    color:green;
    text-align:center;
    background-color:orange;
}
  

    </style>
</head>
<body>
    <!-- this is first heading -->
   <h1>This is heading</h1> 
</body>
</html>