0
0
CSSmarkup~5 mins

Align items in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the CSS property align-items do in a flex container?

The align-items property controls how flex items are aligned along the cross axis (usually vertical) inside a flex container.

It sets the default alignment for all items.

Click to reveal answer
intermediate
Name the possible values of align-items and what they do.
  • flex-start: Align items to the start of the cross axis.
  • flex-end: Align items to the end of the cross axis.
  • center: Center items along the cross axis.
  • baseline: Align items so their text baselines line up.
  • stretch: Stretch items to fill the container (default).
Click to reveal answer
beginner
How does align-items: stretch behave if the flex items have no fixed height?

Items will stretch to fill the container's height along the cross axis, making them all the same height.

Click to reveal answer
intermediate
What is the difference between align-items and justify-content in flexbox?

align-items aligns items along the cross axis (usually vertical).

justify-content aligns items along the main axis (usually horizontal).

Click to reveal answer
beginner
Can align-items be used on non-flex containers?

No. align-items only works on flex containers or grid containers.

Click to reveal answer
What does align-items: center; do in a flex container?
ACenters items horizontally along the main axis
BCenters items vertically along the cross axis
CAligns items to the start of the main axis
DStretches items to fill the container width
Which align-items value makes all flex items the same height by default?
Abaseline
Bflex-start
Cstretch
Dflex-end
If you want text baselines of flex items to line up, which align-items value should you use?
Abaseline
Bflex-end
Ccenter
Dstretch
Which CSS property aligns items along the main axis in flexbox?
Aalign-items
Balign-content
Cflex-direction
Djustify-content
Can align-items be used on a block container that is not a flex or grid container?
ANo, it only works on flex or grid containers
BOnly if display is inline
COnly if items have fixed height
DYes, always
Explain how the align-items property affects the layout of flex items inside a flex container.
Think about vertical alignment in a horizontal flex container.
You got /4 concepts.
    Describe the difference between align-items and justify-content in flexbox layout.
    Consider the directions of alignment in a flex container.
    You got /4 concepts.