CSS Professional Development 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 CSS Professional Development flashcards as text
How is CSS specificity for an ID selector compared to a class selector?
Answer: ID is higher than class
An ID selector has higher specificity than a class selector.
What does the `!important` declaration do?
Answer: Overrides normal specificity rules
`!important` forces a declaration to take precedence over normal cascade order.
Which pseudo-class selects an element when a user hovers over it?
Answer: :hover
`:hover` styles an element while the pointer is over it.
What does the universal selector `*` target?
Answer: All elements
The `*` universal selector matches every element in the document.
Which combinator selects a direct child element?
Answer: >
The `>` child combinator selects direct children only.
What does the `:nth-child(2n)` selector match?
Answer: Every even-positioned child
`2n` matches every even index, selecting even-positioned children.
Which pseudo-element lets you insert generated content before an element?
Answer: ::before
`::before` inserts generated content at the start of an element.