Comments in CSS are generally used to explain the purpose of style CSS properties are declared.
Purpose of the Write Comments in CSS
Comments in CSS are useful for remote persons to understand the purpose of the code.
Comments are not displayed on the browser. CSS Comments are start with /*
and ends with */
. Now you can see all the examples and types on CSS comments.
Types of Comments in CSS
There are two types CSS comments,
- Single line Comment.
- Multi line Comment.
Single Line Comment in CSS
Here, you can see how we declare single-line comments are,
1 2 3 4 5 6 |
<style> /* This is a single line CSS comment */ body { font-family: Arial, sans-serif; } </style> |
See the Pen single line CSS comment by Bikash Panda (@phpcodertech) on CodePen.
Multi Line Comments in CSS
Here, you can see how we write multi line comments are,
1 2 3 4 5 6 7 |
<style> /* This is an example of a multi-line comment in CSS */ body { font-family: Arial, sans-serif; } </style> |
See the Pen multi-line comment in CSS by Bikash Panda (@phpcodertech) on CodePen.
Here is the complete reference about how to Write Comments in CSS.
Also Check:
- How to Embed PDF in Website Using HTML
- CSS Background Image Text Effect
- CSS background-image Properties
Happy Coding..!
3 Replies to “How to Include Comments in CSS”