Selectors
Explore how CSS selectors target HTML elements through tags, classes, and IDs to apply styles. Learn selector specificity to resolve conflicts and effectively design web pages.
You can easily define what a rule in a style sheet does: it declares one or more property and value pairs to apply on a set of HTML nodes within the current document.
In this approach, selectors identify the part of the document that should be styled. Here, you’ll learn them through simple examples.
Tag, class, and ID selectors
The three most frequently used selector types are:
-
the tag selector —applied to every occurrence of an HTML tag
-
the class selector —applied to every occurrence of an HTML tag that has a specific value in its class attribute
-
the ID selector - applied to the ...