Complete Guide to CSS Selector Types (Beginner Friendly)
Knowing the full range of CSS selector types available when writing modern CSS today is crucial to using CSS to the fullest.
In the past 10 years or so, the official specification has added a number of different CSS selectors and many of those selectors have strong support across all modern browsers.
So in this complete guide to CSS selector types, I hope to offer a selector toolset that you can comfortably use in all your production sites. I’ll also include some useful code snippets to assist your learning and remembering these selectors.
Here’s what we’re going to cover:
- Universal selector #
- Type selector #
- Class selector #
- ID selector #
- Attribute selector #
- Attribute selectors with operators and flags #
- Descendant combinator #
- Child combinator #
- General sibling combinator #
- Adjacent sibling combinator #
- Pseudo-class selector types #
- Pseudo-element selector types #
- Combining CSS selector types #
Code language: CSS (css)
Code language: CSS (css)