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 is a block-level element in CSS?
A block-level element takes up the full width available, starts on a new line, and can have width and height set. Examples include <div> and <p>.
Click to reveal answer
beginner
What is an inline element in CSS?
An inline element only takes up as much width as its content, does not start on a new line, and ignores width and height properties. Examples include <span> and <a>.
Click to reveal answer
intermediate
How does inline-block differ from inline and block elements?
Inline-block elements flow like inline elements (do not start on a new line) but can have width and height set like block elements.
Click to reveal answer
beginner
Which CSS property controls whether an element is block, inline, or inline-block?
The 'display' property controls this. For example, 'display: block;', 'display: inline;', and 'display: inline-block;'.
Click to reveal answer
intermediate
Why might you use inline-block instead of inline or block?
Use inline-block when you want elements to sit side by side but still control their size with width and height.
Click to reveal answer
Which element type starts on a new line and takes full width by default?
AInline-block
BInline
CNone of the above
DBlock
✗ Incorrect
Block elements start on a new line and take the full width available.
Which display value allows setting width and height but does not start on a new line?
Ainline-block
Binline
Cblock
Dnone
✗ Incorrect
Inline-block elements behave like inline but accept width and height.
Which of these elements is inline by default?
A<span>
B<div>
C<p>
D<section>
✗ Incorrect
<span> is inline by default.
What CSS property changes an element from inline to block?
Aposition
Bfloat
Cdisplay
Dvisibility
✗ Incorrect
The 'display' property controls the element's display type.
If you want elements side by side with control over size, which display value is best?
Ablock
Binline-block
Cflex
Dinline
✗ Incorrect
Inline-block lets elements sit side by side and lets you set width and height.
Explain the differences between block, inline, and inline-block elements in CSS.
Think about how elements behave in a paragraph or a row.
You got /3 concepts.
Describe a situation where using inline-block is better than block or inline.
Imagine buttons or boxes in a row that need specific sizes.
You got /3 concepts.
Practice
(1/5)
1. Which CSS display property makes an element start on a new line and take the full width available?
easy
A. block
B. inline
C. inline-block
D. none
Solution
Step 1: Understand block behavior
A block element always starts on a new line and stretches to fill the container's width.
Step 2: Compare with other display types
Inline elements flow inside text and don't take full width; inline-block allows size but stays inline.
Final Answer:
block -> Option A
Quick Check:
New line + full width = block [OK]
Hint: Block = new line and full width [OK]
Common Mistakes:
Confusing inline with block and expecting new line
Thinking inline-block takes full width automatically
Choosing none which hides element
2. Which of the following is the correct CSS syntax to make an element display inline-block?
easy
A. display: inline-block;
B. display: block-inline;
C. display: inlineblock;
D. display: block;
Solution
Step 1: Recall correct CSS property value
The correct value to make an element inline-block is exactly inline-block with a hyphen.
Step 2: Check other options for syntax errors
display: block; sets block, not inline-block. block-inline and inlineblock are invalid.
Final Answer:
display: inline-block; -> Option A
Quick Check:
Correct hyphenated syntax = inline-block [OK]
Hint: Use hyphen: inline-block, not inlineblock [OK]
Common Mistakes:
Missing hyphen in inline-block
Mixing order like block-inline
Using block instead of inline-block
3. Given this HTML and CSS, what will be the visual layout of the boxes?
Why do the buttons ignore width and height and stack oddly?
medium
A. Because buttons cannot have width or height set.
B. Because display: inline ignores width and height properties.
C. Because display: block is needed for inline layout.
D. Because margin is missing to separate buttons.
Solution
Step 1: Recall inline element behavior
Inline elements ignore width and height CSS properties; they size to content only.
Step 2: Understand why buttons ignore size
Setting display: inline causes buttons to ignore width and height, so they don't size as expected.
Final Answer:
Because display: inline ignores width and height properties. -> Option B
Quick Check:
Inline ignores size = problem [OK]
Hint: Inline elements ignore width and height [OK]
Common Mistakes:
Thinking buttons can't have size set
Confusing block with inline for side by side
Assuming margin fixes size ignoring
5. You want a navigation menu with links side by side, each with padding and background color. Which display property should you use to allow width, height, and side-by-side layout?
hard
A. display: block;
B. display: none;
C. display: inline;
D. display: inline-block;
Solution
Step 1: Identify layout needs
Links must be side by side and allow setting width, height, padding, and background color.
Step 2: Match display property to needs
Inline-block allows elements to flow horizontally and respects box model properties like padding and background.