The display property, online

Six activities your students do on their own devices. See who's finished, and their scores.

The display property in one minute

What students need to know

By default <p> is already block, but display: block can be set explicitly. The paragraph starts on its own line and spans the full container. Setting display: flex on nav makes its children (typically <a> or <li> elements) flex items, enabling flexible alignment and sizing.

display: none removes the element from layout and leaves no space. visibility: hidden keeps the space but makes it invisible. display: inline-block flows within text like inline, but unlike plain inline, it respects width, height and all padding/margin values.

Mistakes students make

  • CSS declarations require a colon. It should be display: block; not display block;.
  • The value for inline-block must be hyphenated: display: inline-block; not display: inline block; with a space.
  • CSS property names must be lowercase. 'Display' should be written as 'display'.
  • 'inlne' is a typo. The correct value is display: inline;.
PREVIOUS · MODULE 50box-sizing
YOU ARE HERE · MODULE 51The display property
NEXT · MODULE 52Positioning

Discover other journeys with this module

What students will learn in this module

Every question in Module 51

Quick questions

  1. What does display: none do to an element?AHides it and removes it from the layoutBMakes it invisible but keeps its space
  2. Which display value makes an element flow inline but still accept width and height?AinlineBinline-block
  3. True or false: a block element starts on a new line.ATrueBFalse
  4. True or false: you can set width and height on display: inline elements.ATrueBFalse
  5. Which display value turns an element into a flex container?AflexBflexbox

Key terms

Students type the meaning of:

  • display

Match the pairs

div { display: none; }Match it to what it does
a {
  display: inline-block;
  width: 120px;
  padding: 8px;
}
Match it to what it does
display: block makes an element start on a new line and fill the available widthMatch it to what it does
display: flex turns a container into a flexbox layout for its direct childrenMatch it to what it does
div { display: inline block; }Match it to what it does
span { Display: inline; }Match it to what it does

Fill in the blanks

  1. p { display: _____; }

    Hint: Type the display value that makes an element take up the full available width on its own line

  2. span { display: ______; }

    Hint: Type the display value that makes an element flow within text without starting a new line

  3. div { display: ____; }

    Hint: Type the display value that hides an element completely — removing it from the layout

  4. a { display: ____________; }

    Hint: Type the display value that flows inline but accepts width and height like a block element

  5. nav { display: ____; }

    Hint: Type the display value that turns a container into a flexbox layout

Spot the error

Question 1

Ap { display block; }Bdiv { display: none; }Cspan { display: inline; }

Question 2

Adiv { display: flex; }Bspan { display: inline block; }Cp { display: none; }

Question 3

Anav { display: flex; }Bp { display: block; }Cspan { Display: inline; }

Question 4

Adiv { display: flex; }Bp { display: block; }Ca { display: inline; }Dspan { display: inlne; }

Question 5

Aheader { display: flex; }Bnav { display: block; }Cp { display: inline; }Dspan { display: none; }Ediv { display: flex-row; }