CSS selectors are identifiers used to select HTML elements that you want to style. They are usually the prefix before the opening bracket in a code or declaration block. E.g.
Assuming I want to style a paragraph element in HTML, using an element selector, I'll do the following:
So, the p above is the CSS selector.
There are a number of CSS selectors, the simplest among them are:
Element selector, Id selector, class selector, and universal selector. For detailed info on these selectors, visit my post on "The HTML DOM and CSS Syntax"
Other types of selectors include attribute, pseudo-element, pseudo-class, combinators, and multiple CSS selectors. If you want to know more about them, visit my post on "How to use CSS selectors"
If I should classify them, I'll have:
- Simple selectors
- Multiple selectors
- Attribute selectors
- Pseudo-elements, and
- Pseudo-classes selectors