0
0
CSSmarkup~20 mins

Justify content in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Justify Content Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What does justify-content: space-between; do in a flex container?
Imagine you have a row of boxes inside a container. What happens when you use justify-content: space-between; on the container?
AThe boxes are spread out with equal space before the first and after the last box.
BThe boxes are packed at the start with no space between them.
CThe boxes are spread out so the first is at the start, the last is at the end, and equal space is between each box.
DThe boxes are all grouped at the center with equal space around them.
Attempts:
2 left
💡 Hint
Think about how the space is distributed between and around the boxes.
📝 Syntax
intermediate
1:30remaining
Which CSS snippet correctly centers flex items horizontally?
You want to center all items inside a flex container horizontally. Which code snippet does this correctly?
CSS
display: flex;
/* missing justify-content */
Ajustify-content: flex-start;
Bjustify-content: center;
Cjustify-content: space-around;
Djustify-content: stretch;
Attempts:
2 left
💡 Hint
Centering means items are grouped in the middle with equal space on both sides.
rendering
advanced
2:00remaining
What is the visual result of justify-content: space-evenly; in a flex container?
You have five boxes in a row inside a flex container with justify-content: space-evenly;. What will you see?
CSS
display: flex;
justify-content: space-evenly;
ABoxes have equal space between them and also equal space before the first and after the last box.
BBoxes are packed tightly at the start with no space between them.
CBoxes have equal space only between them but no space at the edges.
DBoxes are centered with extra space only on the right side.
Attempts:
2 left
💡 Hint
Think about how space is shared inside the container including edges.
selector
advanced
2:30remaining
Which CSS selector targets only flex containers with justify-content: center;?
You want to style only flex containers that have justify-content: center;. Which selector works?
Adiv.flex-container[style*='justify-content: center']
B.flex-container.justify-content-center
Cdiv.flex-container > *:first-child
Ddiv.flex-container:has([style*='justify-content: center'])
Attempts:
2 left
💡 Hint
Look for a selector that matches inline styles containing the text.
accessibility
expert
3:00remaining
How does justify-content affect keyboard navigation in a flex container?
Consider a horizontal flex container with several focusable buttons. How does changing justify-content impact keyboard users navigating with Tab key?
AIt reverses the tab order when set to <code>flex-end</code>.
BIt changes the tab order to match the visual order of items on screen.
CIt disables keyboard navigation if set to <code>space-between</code>.
DIt does not affect the tab order; keyboard navigation follows the DOM order regardless of visual layout.
Attempts:
2 left
💡 Hint
Think about how keyboard focus moves through elements in HTML.