CSS Comments

Please Share On:

Definition:

  • CSS Comments are used to comment on certain parts that don’t function and show on the front page.
  • CSS Comments are used to explain the code. It helps a developer to understand the other’s written code easily.
  • CSS Comments start with “/*” and end with “*/”. Anything in these comments will be ignored by the browser.

Syntax:

/* This is my single line comment. */

/*This is a 
multiline comments.*/

Source Code

<!DOCTYPE html>
<html>
<style>
/*This is single line comment.*/
.paragraph1{
background-color:red;
}

/*This is multi-line comment.
 This is multi-line comment.*/
.paragraph2{
background-color:coral;
}
</style>
<body>
<h3>CSS Comments. </h3>
<h3 class="paragraph1"><center>This is my first paragraph.<br/> </center></h3>
<h3 class="paragraph2"><center>This is my second paragraph.<br/> </center></h3>
<p>Here you can see the comments are not shown, which is simply ignored by browser.</p>
</body>
</html>

Output:



Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright @2023. All Right Reserved.


Social media & sharing icons powered by UltimatelySocial