+ 1

Which selector would win?

Does a chained selector have a higher specificity than a class or ID selector? For example, which selector would win: .special or h1.special or #special?

17th Sep 2018, 12:54 PM
Ricardo Prato
Ricardo Prato - avatar
3 odpowiedzi
+ 8
If multiple selectors target on the same element, the result would based on specificity and the rule order. Don't forget there's a reason it's called Cascading Style Sheets, anything come after will override the previous one. 😉 More info on specificity:- https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
17th Sep 2018, 1:08 PM
Zephyr Koo
Zephyr Koo - avatar
+ 3
Glad you find it useful, you're welcome! 😄
19th Sep 2018, 2:30 PM
Zephyr Koo
Zephyr Koo - avatar
+ 1
Thank you very much for your help👍😆
17th Sep 2018, 4:18 PM
Ricardo Prato
Ricardo Prato - avatar