Guess the CSS: flexbox and grid edition
Each Question shows a rendered layout. Can you tell which CSS produced it? Every picture is drawn from box sizes measured in a real browser. You'll work through the main axis versus the cross axis, flex: 1 versus flex: auto, fr versus %, grid-auto-flow: dense, and why margin: auto centers in some layouts but not others.
Questions
- Not answered. Which declaration on
.rowproduced this layout? - Not answered. Which declaration on
.stackproduced this layout? - Not answered. Which declaration on
.rowdistributed the space like this? - Not answered. Which declaration on
.tagspacked both rows at the top? - Not answered. Which declaration produced these gutters?
- Not answered. Which declaration, applied to every item, made the three items equal?
- Not answered. Which declarations, applied to every item, render exactly these widths?
- Not answered. How wide does
.brender, in px? - Not answered. Why won't
.mainshrink to the 400px that's left? - Not answered. Which
grid-template-columnsvalue made the grid overflow by 20px? - Not answered. Which
grid-template-columnsvalues render exactly these column widths? - Not answered. The author wanted two equal columns. Which
grid-template-columnsvalue gave this 400 / 200 split instead? - Not answered. Which
grid-template-columnsvalue stretched two items across the whole row? - Not answered. Which declaration on
.boardmoved the whole grid to the center? - Not answered. Which declaration produced this placement?
- Not answered. Add
grid-auto-flow: dense. Which item moves into the empty cell? - Not answered.
margin: autocentered the box horizontally but left it at the top. Why? - Not answered. Which single declaration on
.boxcenters it in both directions? - Not answered. Which declaration pushed item 4 to the far right while items 1 to 3 stayed on the left?
- Not answered. Which parent setups make
margin: autocenter this box in both directions?