Create a responsive gallery with at least six cards. Use repeat(), minmax(), auto-fit, gap and a featured item spanning two columns.
Quiz — 10 MCQs
- Which declaration enables Grid? (A) display: grid (B) layout: grid (C) position: grid (D) float: grid. Answer: A. Display grid creates a grid container.
- What does fr represent? (A) A fraction of available grid space (B) A font family (C) A fixed pixel unit (D) A border style. Answer: A. Fr distributes space under the grid track sizing algorithm.
- What does gap control? (A) Space between tracks (B) Font size (C) Selector priority (D) Position type. Answer: A. Gap defines gutters between rows and columns.
- What does repeat() do? (A) Repeats track definitions (B) Repeats JavaScript (C) Repeats an animation only (D) Duplicates HTML elements. Answer: A. Repeat reduces repetitive grid track declarations.
- What does minmax() define? (A) Minimum and maximum track sizing bounds (B) Text color (C) Font weight (D) Link behavior. Answer: A. It specifies a sizing range for tracks.
- What does grid-column: 1 / 3 specify? (A) Start at line 1 and end at line 3 (B) Three columns always (C) One pixel width (D) Three grid containers. Answer: A. It defines the start and end grid lines.
- What is an implicit track? (A) A track created as needed beyond the explicit grid (B) A CSS comment (C) A font fallback (D) A hidden element. Answer: A. Implicit tracks are generated when placement requires them.
- What does auto-fit do in repeated grid tracks? (A) Collapses empty repeated tracks where appropriate (B) Always creates exactly one column (C) Removes all content (D) Changes font size. Answer: A. Auto-fit collapses empty repeated tracks under applicable sizing conditions.
- Which property controls implicit row sizes? (A) grid-auto-rows (B) grid-row-color (C) font-size (D) outline. Answer: A. Grid-auto-rows sizes implicit rows.
- Can Grid place an item across multiple columns? (A) Yes (B) No (C) Only with floats (D) Only through JavaScript. Answer: A. Grid items can span multiple tracks.
Key Takeaways
- Grid organizes content across rows and columns.
- Use fr, repeat(), minmax() and gap for flexible layouts.
- Understand explicit tracks, implicit tracks and grid-line placement.