CSS Tutorial

The language for styling web pages.

CSS Selectors

CSS Selectors

CSS selectors are used to "find" (or select) the HTML elements you want to style.

Types of Selectors:

SelectorExampleDescription
ElementpAll <p> elements
Id#myIdElement with id="myId"
Class.myClassAll elements with class="myClass"
Universal*All elements
Groupingh1, h2, pAll h1, h2, and p elements

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics