A. grid-template-rows must have commas between values
B. Commas should not be used between column sizes
C. display: grid; should be display: grid-container;
D. Column sizes must all be the same unit
Solution
Step 1: Check syntax for grid-template-columns
Values should be space-separated, not comma-separated.
Step 2: Verify other options
grid-template-rows is correct without commas; display: grid is valid; units can differ.
Final Answer:
Commas should not be used between column sizes -> Option B
Quick Check:
Grid values are space-separated, not comma-separated [OK]
Hint: Use spaces, not commas, between grid sizes [OK]
Common Mistakes:
Using commas between grid sizes
Changing display property incorrectly
Thinking units must match
5. You want a grid with 4 equal columns and 3 rows where the first row is 100px tall and the others share remaining space equally. Which CSS is correct?
hard
A. grid-template-columns: repeat(3, 1fr); grid-template-rows: 100px 1fr 1fr 1fr;
B. grid-template-columns: 4fr; grid-template-rows: 100px auto auto;
C. grid-template-columns: repeat(4, 1fr); grid-template-rows: 100px 1fr 1fr;
D. grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: 100px 100px 100px;
Solution
Step 1: Set 4 equal columns
Using repeat(4, 1fr) creates 4 columns each taking equal space.
Step 2: Define 3 rows with first fixed and others flexible
grid-template-rows: 100px 1fr 1fr; sets first row fixed 100px, next two share remaining space equally.
Final Answer:
grid-template-columns: repeat(4, 1fr); grid-template-rows: 100px 1fr 1fr; -> Option C
Quick Check:
repeat() for columns, fixed + fractional rows [OK]
Hint: Use repeat() for equal columns and 1fr for flexible rows [OK]