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;.
What students will learn in this module
Every question in Module 51
Quick questions
- What does display: none do to an element?AHides it and removes it from the layoutBMakes it invisible but keeps its space
- Which display value makes an element flow inline but still accept width and height?AinlineBinline-block
- True or false: a block element starts on a new line.ATrueBFalse
- True or false: you can set width and height on display: inline elements.ATrueBFalse
- 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 doesa {
display: inline-block;
width: 120px;
padding: 8px;
}Match it to what it doesdisplay: block makes an element start on a new line and fill the available widthMatch it to what it doesdisplay: flex turns a container into a flexbox layout for its direct childrenMatch it to what it doesdiv { display: inline block; }Match it to what it doesspan { Display: inline; }Match it to what it doesFill in the blanks
p { display: _____; }Hint: Type the display value that makes an element take up the full available width on its own line
span { display: ______; }Hint: Type the display value that makes an element flow within text without starting a new line
div { display: ____; }Hint: Type the display value that hides an element completely — removing it from the layout
a { display: ____________; }Hint: Type the display value that flows inline but accepts width and height like a block element
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; }
