How to write HTML comment
<!-- Write HTML comment here in HTML file -->
The above is an example of an HTML comment. You can also break the comment into multiple lines. See the example below:
<!-- You can break the comment into multiple lines. -->
HTML comment syntax
Whatever you write in between “<!–” and “–>” will be treated as a comment.
See the keyboard shortcuts for commenting at the bottom.
How to write CSS comments?
/* Write your comment here in CSS file */
No matter if you write a single line or many lines of comment, the syntax is the same in CSS. Whatever you write in between the two slashes & two asterisks, the web browsers will ignore it. Above is an example of a CSS comment.
Wrong syntax in CSS comments
//this is an incorrect syntax
You may see this double slashes (//) syntax in some places but it’s not a valid comment in CSS. This type of syntax works on SASS and SCSS but it does not work in CSS.
Examples of valid comments in CSS
/*======== Whatever you style it, there is no problem ========*/ /** * Make notes for yourself * There is no problem with it. * ******/ /* John and marry worked for footer. But John only has access to our GitHub repo. */
The keyboard shortcut for HTML CSS comment
On mac, it’s (Cmd + /)
On windows, it’s (Ctrl + /)
That means if you’re on a CSS file and if you hit these two buttons Ctrl + / (macOS: Cmd + /), the line(s) will be commented out.