0
0
CSSmarkup~20 mins

Block vs inline vs inline-block in CSS - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Display Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the main difference between block and inline elements?
Which statement best describes how block and inline elements behave in a browser?
ABlock elements only take as much width as needed and flow within a line; inline elements take the full width available and start on a new line.
BBlock elements take the full width available and start on a new line; inline elements only take as much width as needed and flow within a line.
CBoth block and inline elements take the full width available but block elements can have padding and margin, inline elements cannot.
DInline elements always start on a new line, block elements flow within a line.
Attempts:
2 left
💡 Hint
Think about how paragraphs and links behave differently in a text.
📝 Syntax
intermediate
1:30remaining
Which CSS rule correctly makes an element behave like inline-block?
Select the CSS declaration that makes an element behave like inline-block.
Adisplay: inline-block;
Bdisplay: block-inline;
Cdisplay: inline_block;
Ddisplay: block-inline-block;
Attempts:
2 left
💡 Hint
Check the exact spelling and hyphenation of the display property value.
rendering
advanced
2:30remaining
What will be the visual layout of these elements?
Given this HTML and CSS, what will you see in the browser?

<style>
.box { width: 5rem; height: 5rem; background: coral; margin: 0.5rem; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
</style>
<div class="block box">Block</div>
<div class="inline box">Inline</div>
<div class="inline-block box">Inline-block</div>
AThe block box is on its own line, the inline and inline-block boxes appear side by side on the same line.
BAll three boxes appear stacked vertically, each on its own line.
CThe inline box is on its own line, block and inline-block boxes appear side by side.
DThe inline-block box is hidden, block and inline boxes appear side by side.
Attempts:
2 left
💡 Hint
Remember how block elements start on new lines and inline elements flow inside lines.
selector
advanced
2:00remaining
Which CSS selector targets only inline-block elements?
Given multiple elements with different display values, which selector matches only elements with display: inline-block?
A*:inline-block
B.inline-block
C:display(inline-block)
D[style*='inline-block']
Attempts:
2 left
💡 Hint
Think about how CSS attribute selectors work and what is valid syntax.
accessibility
expert
3:00remaining
How does using inline-block affect keyboard navigation and screen readers?
Which statement about accessibility is true when using display: inline-block on interactive elements?
AInline-block elements automatically become focusable and are always announced as buttons by screen readers.
BInline-block elements are ignored by screen readers and cannot be focused by keyboard navigation.
CInline-block elements behave exactly like inline elements for accessibility, so they cannot receive keyboard focus unless explicitly made focusable.
DInline-block elements behave like inline elements visually but keep block-level accessibility features, so keyboard navigation and screen readers treat them as blocks.
Attempts:
2 left
💡 Hint
Consider how display affects focus and screen reader behavior by default.