CSS Comments · codenexium.com

Comments

CSS comments are ignored by the browser and help document your code:

Demo: CSS Comments
HTML
<p class="commented">Comments are visible in source but not in rendering</p>
CSS
/* This is a single-line comment */

/*
This is a
multi-line comment
*/

.commented {
color: #6366f1;  /* inline comment */
font-size: 1.25rem;
}
Live Output Window

CSS vs HTML Comments

Language Comment Syntax
CSS /* comment */
HTML <!-- comment -->
JavaScript // comment or /* comment */

Best Practices

/* ================
   Layout Sections
   ================ */

/* Header */
.header { ... }

/* Navigation */
.nav { ... }

/* Footer */
.footer { ... }

Use comments to organize large stylesheets into logical sections - they make maintenance much easier.

Courses