Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does the CSS display property control?
The display property controls how an element is shown on the page, such as whether it behaves like a block, inline, or is hidden.
Click to reveal answer
beginner
What is the difference between display: block; and display: inline;?
display: block; makes the element take the full width and start on a new line. display: inline; makes the element flow within text without starting a new line.
Click to reveal answer
beginner
What does display: none; do to an element?
It hides the element completely. The element does not take up any space on the page and is not visible.
Click to reveal answer
intermediate
Name two common values of the display property used for layout.
Two common values are block and inline. Others include flex and grid for advanced layouts.
Click to reveal answer
intermediate
How does display: flex; help in web design?
display: flex; creates a flexible container that arranges child elements in a row or column, making it easier to align and space items responsively.
Click to reveal answer
Which display value makes an element invisible and removes it from the page layout?
Ainline
Bhidden
Cnone
Dblock
✗ Incorrect
display: none; hides the element and removes it from the layout. hidden is not a valid display value.
What happens when you set display: inline; on a <div> element?
AIt behaves like inline text and does not start a new line.
BIt creates a flexible container.
CIt becomes invisible.
DIt behaves like a block element and starts on a new line.
✗ Incorrect
display: inline; makes the element flow with text and not start a new line.
Which display value is best for creating a flexible layout that aligns items horizontally or vertically?
Ainline
Bflex
Cblock
Dnone
✗ Incorrect
display: flex; creates a flexible container for layout alignment.
If you want an element to take the full width available and start on a new line, which display value should you use?
Ablock
Binline
Cnone
Dflex
✗ Incorrect
display: block; makes the element take full width and start on a new line.
Which of these is NOT a valid display property value?
Aflex
Binline-block
Cgrid
Dhidden
✗ Incorrect
hidden is not a valid display value. To hide elements, use display: none;.
Explain how the display property affects the layout of elements on a webpage.
Think about how elements behave visually and how they take space.
You got /4 concepts.
Describe a situation where you would use display: flex; instead of display: block;.
Consider how you arrange multiple items in a container.
You got /4 concepts.
Practice
(1/5)
1. What does the CSS display: none; property do to an element on a webpage?
easy
A. It hides the element and removes it from the page layout.
B. It makes the element visible but transparent.
C. It changes the element to a block-level element.
D. It makes the element inline without line breaks.
Solution
Step 1: Understand the effect of display: none;
This property hides the element completely and removes it from the page layout, so it takes no space.
Step 2: Compare with other display values
Unlike visibility: hidden; which hides but keeps space, display: none; removes the element entirely.
Final Answer:
It hides the element and removes it from the page layout. -> Option A
Quick Check:
display: none; = hidden and no space [OK]
Hint: None means hidden and no space taken [OK]
Common Mistakes:
Confusing with visibility: hidden
Thinking it only makes element invisible but keeps space
Mixing with display: inline or block
2. Which of the following is the correct CSS syntax to make an element a flex container?
easy
A. display-flex: true;
B. display = flex;
C. display: flex;
D. flex-display: block;
Solution
Step 1: Recall correct CSS property syntax
CSS properties use a colon : to assign values, not equals =.
Step 2: Identify the correct property and value
The property is display and the value to create a flex container is flex.
Final Answer:
display: flex; -> Option C
Quick Check:
Correct CSS syntax uses colon and display: flex; [OK]
Hint: Use colon, not equals, for CSS properties [OK]
Common Mistakes:
Using equals sign instead of colon
Incorrect property names like display-flex
Adding extra words like true
3. Given this HTML and CSS, what will be the visible layout of the items?
A. The items A, B, C appear as inline text separated by spaces.
B. The items A, B, C appear side by side horizontally.
C. The items A, B, C are hidden and not visible.
D. The items A, B, C appear stacked vertically in a column.
Solution
Step 1: Understand display: flex; with flex-direction: column;
Flex container arranges children in a flexible box. The column direction stacks items vertically.
Step 2: Predict the layout of the spans
Each <span> will appear one below the other in a vertical column.
Final Answer:
The items A, B, C appear stacked vertically in a column. -> Option D
Quick Check:
flex-direction: column; stacks vertically [OK]
Hint: Flex column stacks items vertically [OK]
Common Mistakes:
Assuming flex always arranges horizontally
Confusing inline elements with flex behavior
Ignoring flex-direction property
4. You want to hide a paragraph but keep its space on the page. Which CSS property and value should you use? The following code does not work as expected:
p {
display: none;
}
What is the correct fix?
medium
A. Use display: inline; to hide the paragraph
B. Change display: none; to visibility: hidden;
C. Add opacity: 0; instead of display
D. Change display: none; to display: block;
Solution
Step 1: Understand difference between display: none; and visibility: hidden;
display: none; removes element and space, visibility: hidden; hides element but keeps space.
Step 2: Apply the correct property to keep space
Use visibility: hidden; to hide content but preserve layout space.
Final Answer:
Change display: none; to visibility: hidden; -> Option B
Quick Check:
Keep space by using visibility: hidden; [OK]
Hint: Use visibility hidden to keep space but hide [OK]
Common Mistakes:
Using display none and expecting space to remain
Using opacity 0 but element still clickable
Confusing display inline with hiding
5. You have a navigation bar with list items. You want the list items to appear horizontally with equal spacing and be centered. Which CSS display property and layout method should you use?
hard
A. Use display: flex; on the container with justify-content: space-around;.
B. Use display: block; on list items and text-align: center; on the container.
C. Use display: inline; on the container and margin: auto; on list items.
D. Use display: grid; on list items with grid-template-columns: repeat(3, 1fr);.
Solution
Step 1: Identify the container and desired layout
The container holds list items that should be horizontal, spaced equally, and centered.
Step 2: Choose display and alignment properties
display: flex; on container creates a flexible row layout. justify-content: space-around; spaces items evenly with space around them.
Final Answer:
Use display: flex; on the container with justify-content: space-around;. -> Option A