HTML & CSS Styling CoreLesson 15Free preview
Selectors & Specificity
This lesson is part of Intro to HTML & CSS · All levels
Summary
The selector determines which elements receive the style, whereas the specificity determines which rules win when in conflict. This lesson includes element selectors, classes, id, attributes, pseudo-classes, as well as a hierarchy of specificities. Understanding these rules drastically saves CSS debugging time.
Key points
- Selector types: elements, .kelas, #id, [attribute], and pseudo such as:hover
- Specificity: id > class > elements; !important beating all
- The descendant selector selects the child within a particular parent
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.