(Selectors, Appearance, & Files) 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 (Selectors, Appearance, & Files) flashcards as text
Which selector matches elements whose class attribute contains the word "news"?
Answer: [class~="news"]
The ~= attribute selector matches a whitespace-separated word within the value.
When two rules have equal specificity, which one wins?
Answer: The one declared last in the stylesheet
With equal specificity, source order decides and the later rule overrides.
Which pseudo-element inserts generated content before an element's content?
Answer: ::before
The ::before pseudo-element with the content property inserts content at the start.
What is the @import rule used for in CSS?
Answer: Importing one stylesheet into another
@import pulls the contents of another CSS file into the current stylesheet.
Which property controls the size of text?
Answer: font-size
font-size sets the size of the font, often in px, em, or rem.
Which has the highest specificity?
Answer: An id selector
ID selectors carry higher specificity than class or element selectors.
How is an internal stylesheet added to an HTML document?
Answer: Inside a element in the
Internal CSS is placed within a element, typically in the document head.