Skip to main content

CSS Comments — exercises and bug fixes

5 hands-on exercises and 5 find-the-bug challenges for the CSS Comments lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.

Exercises(5)

  1. 1

    Comment out a rule

    easy10 min

    Disable the red rule with a comment so the blue one applies.

  2. 2

    Comment a single declaration

    easy10 min

    Disable just the font-size, keeping the colour green.

  3. 3

    Label a section

    easy10 min

    Add a comment above a rule that makes #title orange.

  4. 4

    Write a multi-line comment

    easy10 min

    Use a comment spanning lines, then make #text purple.

  5. 5

    Keep one of two rules

    medium10 min

    Comment out the first rule so the teal one wins.

Find the bug(5)

  1. 1

    Fix the unclosed comment

    easy8 min

    An unclosed comment swallows everything after it.

  2. 2

    Fix the JavaScript comment

    easy8 min

    CSS has no double-slash comments, so this silently disabled the font-size.

  3. 3

    Fix the HTML comment

    easy8 min

    CSS comments use slash-star, not angle brackets.

  4. 4

    Fix the reversed markers

    easy8 min

    A comment opens with slash-star and closes with star-slash.

  5. 5

    Fix the commented-out wrong rule

    easy8 min

    The teal rule should survive, not the red one.

Ready to write the code?

The editor, the automatic checks and the worked solutions open up with an account.

Open the workspace