Skip to main content

CSS Text Alignment — exercises and bug fixes

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

    Centre a paragraph

    easy10 min

    Centre the #text.

  2. 2

    Align to the right

    easy10 min

    Push #text to the right edge.

  3. 3

    Justify a paragraph

    easy10 min

    Spread #text to both margins.

  4. 4

    Use logical alignment

    easy10 min

    Align #text to the end of the writing direction.

  5. 5

    Align heading and body differently

    medium10 min

    Centre the heading and justify the paragraph.

Find the bug(5)

  1. 1

    Fix the shortened property

    easy8 min

    The property is text-align.

  2. 2

    Fix the British spelling

    easy8 min

    The CSS value is spelled center.

  3. 3

    Fix the invalid value

    easy8 min

    There is no "middle" text alignment.

  4. 4

    Fix the margin used to centre text

    easy8 min

    Auto margins centre a box, not its text.

  5. 5

    Fix the alignment on the wrong element

    easy8 min

    The paragraph should be justified, not the heading.

Ready to write the code?

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

Open the workspace