(Layout & Images) Flashcards
7 cards from real CSS practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 (Layout & Images) flashcards as text
Which property defines the number and size of columns in a grid?
Answer: grid-template-columns
grid-template-columns specifies the track sizes for grid columns.
What does the 'fr' unit represent in CSS Grid?
Answer: A fraction of the available space
The fr unit represents a fraction of the free space in the grid container.
Which property makes an image scale responsively to its container's width?
Answer: max-width: 100%
Setting max-width: 100% lets an image shrink to fit its container while not exceeding its natural size.
What does 'flex-wrap: wrap' do?
Answer: Allows flex items to flow onto multiple lines
flex-wrap: wrap lets items move to new lines when they exceed the container width.
Which value of 'object-fit' scales an image down to fit inside its box without cropping?
Answer: contain
object-fit: contain scales the image to fit entirely within the box, preserving aspect ratio.
How do you center a block element horizontally within its parent?
Answer: margin: 0 auto with a set width
A block with a defined width and margin: 0 auto centers horizontally.
Which CSS property controls the stacking order of overlapping elements?
Answer: z-index
z-index sets the stacking order of positioned elements.