Skip to main content

CSS Element Selector — exercises and bug fixes

5 hands-on exercises and 5 find-the-bug challenges for the CSS Element Selector 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

    Target every paragraph

    easy10 min

    Make all p elements red.

  2. 2

    Target every div

    easy10 min

    Give all div elements a 2px solid border.

  3. 3

    Target a span

    easy10 min

    Make span elements blue.

  4. 4

    Style the body

    easy10 min

    Give the body a 40px padding.

  5. 5

    Combine two element rules

    medium10 min

    Make paragraphs green and spans red.

Find the bug(5)

  1. 1

    Fix the selector written with a dot

    easy8 min

    An element selector has no dot prefix.

  2. 2

    Fix the misspelled element

    easy8 min

    "paragraph" is not an element name.

  3. 3

    Fix the wrong element targeted

    easy8 min

    The span rule was meant for paragraphs.

  4. 4

    Fix the missing braces

    easy8 min

    The declaration is not wrapped in braces, so it is ignored.

  5. 5

    Fix the missing semicolon

    easy8 min

    Without a semicolon the next declaration is swallowed.

Ready to write the code?

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

Open the workspace