Everything You Need to Know about CSS Comments

Dan Gold

Written by Dan

In CSS, comments are used to add notes and explanations to your code. They are ignored by the browser and do not affect the way your website is displayed.

To write a comment in CSS, you need to start with the /* characters, followed by the text of your comment, and end with the */ characters.

Here’s an example:

/* This is a single line comment */

You can span across multiple lines like this:

/* This is a comment in CSS. It can span
multiple lines and will be ignored by the
browser. */

In Sass you don’t need to end your comment with the */ characters. You only need to start with the // characters.

Here’s what that looks like:

// This is a single line comment

You can also span multiple lines like this:

// This is a comment in Sass. It can span
// multiple lines and will be ignored by the
// browser.

I hope you found this guide useful!

Last updated

July 13th, 2023