1. What ends a CSS declaration?
- A comma
- A period
- A semicolon
- A colon
Show answer
Answer: A semicolon
A semicolon `;` separates declarations inside the block.
Lesson: CSS Syntax
19 questions from the CSS Fundamentals: Layout, Flexbox, Grid and Responsive Design course, each with the correct answer and an explanation. Try to answer before you open the answer.
Answer: A semicolon
A semicolon `;` separates declarations inside the block.
Lesson: CSS Syntax
Answer: A > B
`>` restricts the match to immediate children, not all descendants.
Lesson: Combinators
Answer: content → padding → border → margin
Padding sits right against the content, then the border, then the margin outside everything.
Lesson: The Box Model
Answer: Its nearest positioned ancestor
It looks up the tree for the closest ancestor with position other than static; if none, it falls back to the viewport.
Lesson: The position Property
Answer: flex-grow
flex-grow decides how leftover space is distributed among items.
Lesson: Flex Items
Answer: A fraction of the available space
1fr means "one share of whatever space is left after fixed-size tracks are placed."
Lesson: Grid Basics
Answer: min-width
min-width queries add styles as the screen gets wider, matching the mobile-first base-then-enhance pattern.
Lesson: Media Queries & Mobile-First
Answer: The id selector
id selectors carry higher specificity than class selectors, regardless of source order.
Lesson: Specificity
Answer: var(--gap)
The var() function reads a custom property's current value.
Answer: :has()
:has() is the relational "parent" selector.
Answer: place-items: center
place-items: center centers grid children on both axes in one declaration.
Lesson: Centering Techniques
Answer: content, padding, border, margin
Content sits inside padding, then border, then margin.
Lesson: Sticky Footer & Card Layouts
Answer: Width includes padding and border
It makes width math predictable.
Lesson: Sticky Footer & Card Layouts
Answer: Its nearest positioned ancestor
Without one it falls back to the initial containing block.
Lesson: Sticky Footer & Card Layouts
Answer: CSS Grid
Grid handles rows and columns together.
Lesson: Sticky Footer & Card Layouts
Answer: rem
rem is relative to the root font size.
Lesson: Sticky Footer & Card Layouts
Answer: The id selector
Ids have higher specificity.
Lesson: Sticky Footer & Card Layouts
Answer: transform and opacity
They avoid layout and run on the GPU.
Lesson: Sticky Footer & Card Layouts
Answer: var(--gap)
var() reads custom properties.
Lesson: Sticky Footer & Card Layouts