Nearby lessons

5 of 19

💬 CSS Comments

📌 What are CSS Comments?

CSS Comments are used to explain the code, document logic, and improve maintainability. They are not rendered by browsers, making them a useful tool during development and collaboration.

CSS comments let you leave notes in your stylesheet that help explain your code. They are ignored by the browser and don't affect how the CSS works.

They follow the syntax /* comment */ and can span single or multiple lines.

1️⃣ Single-line Comment

Used for short descriptions or to disable one line of code. CSS treats it the same as a multi-line comment with one line inside.

Example02
🎨Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

2️⃣ Multi-line Comment

Multi-line comments span several lines and are useful for block-level explanations or large sections of notes.

Example03
🎨Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

🧠 Test Your Knowledge

5 Questions
Progress: 0 / 5