CSS Selectors Visual Guide

What is the CSS Selectors Visual Guide?

A visual guide to the most popular CSS selectors. CSS selectors are patterns used to select and style HTML elements. The guide covers traditional selectors plus pseudo-classes (single colon: :hover, :first-child—styles based on state or relation) and pseudo-elements (double colon: ::before, ::first-line—styles for parts of an element). Each selector includes code examples and visual demos. Reference for developers learning or reviewing CSS.

What the Guide Covers

Popular CSS selectors with examples.

Basic Selectors

Universal (*), element, .class, #id. Multiple classes, comma combinator.

Combinators

Descendant (space), adjacent (+), child (>), general sibling (~). Lobotomized owl.

Attribute Selectors

[attr], [attr=val], [attr~=val], [attr*=val], [attr^=val], [attr$=val].

Pseudo-classes

:link, :visited, :hover, :active, :focus, :checked, :disabled, :valid, :first-child, :nth-child, :target, :not(), :has().

Pseudo-elements

::before, ::after, ::first-letter, ::first-line, ::placeholder, ::selection, ::marker.

Visual Examples

Each selector has code snippets and live visual examples.

How To Use the Guide

Reference the guide in three ways.

Browse Selectors

Scroll or navigate. Find the selector you need.

Read Examples

Each selector has CSS snippets and visual demos.

Copy & Apply

Adapt the code for your project.

Tips for CSS Selectors

Get the most out of the guide.

Pseudo-class vs Pseudo-element

: for state/relation. :: for parts of element.

:has()

Parent selector. Style element if it contains a match.

:not()

Exclusion filter. Target elements that do not match.

Great For Developers

Who benefits from the guide?

Frontend Developers

Quick reference. Selector patterns.

Beginners

Learn selectors with visual examples.

Designers

Understand how CSS targets elements.

Teams

Shared reference. Consistent patterns.

Why Use a CSS Selectors Guide?

Visual reference for selector patterns.

Visual

See each selector in action.

Complete

Basic, combinators, attributes, pseudo.

Examples

Code snippets. Copy and adapt.

Free

Reference anytime. No account.

Technical Details

About the guide.

Scope

Basic selectors, combinators, attribute selectors, pseudo-classes, pseudo-elements.

Format

Each selector: name, description, CSS example, visual demo.

Related

SVG reference, color picker, color palette generator.

Frequently Asked Questions

Have questions? We have answers.