Skip to main content

HTML Div & Span — exercises and bug fixes

5 hands-on exercises and 5 find-the-bug challenges for the HTML Div & Span 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

    Group a block with a div

    easy10 min

    Wrap two paragraphs in a div.

  2. 2

    Target text with a span

    easy10 min

    Wrap one word in a span with a class.

  3. 3

    Give a div a class

    easy10 min

    Add a div with the class "card".

  4. 4

    Nest a span inside a div

    easy10 min

    Put a span inside a div's paragraph.

  5. 5

    Prefer semantics where possible

    medium10 min

    Use a section instead of a div for a titled block.

Find the bug(5)

  1. 1

    Fix the span wrapping blocks

    easy8 min

    A span cannot contain paragraphs.

  2. 2

    Fix the div used inline

    easy8 min

    Highlighting a word inline needs a span.

  3. 3

    Fix the div where a section belongs

    easy8 min

    A titled block should be a section.

  4. 4

    Fix the missing class

    easy8 min

    The wrapper has no class to target.

  5. 5

    Fix the div used as a list

    easy8 min

    Repeated items should be a real list.

Ready to write the code?

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

Open the workspace