← Quiz: CSS Basics: all 10 questions
Quiz: CSS Basics · Question 3 of 10
Two rules: .title { color: red } and main { color: blue } both match an element. Which colour wins?
Two rules: .title { color: red } and #main { color: blue } both match an element. Which colour wins?
- A.red
- B.blue
- C.whichever is written later
- D.black
Answer & explanation
Correct answer: blue
An id selector has higher specificity than a class.
Can you get the rest right without peeking?
Take the timed Quiz: CSS Basics quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →