Skip to main content
D
CSS
CSS Selectors

CSS Selectors

CSS selectors target the HTML elements you want to style.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

CSS uses selectors to find elements on the page. You can target elements by their tag name, class, or id. This allows developers to style specific sections without affecting the entire site.

Example

Example
1/* this shows different selectors */
2p {
3  color: red;
4}
5
6#special {
7  color: blue;
8}
9
10.highlight {
11  color: yellow;
12}

Key Points

  • Element selectors target specific HTML tags.
  • ID selectors target one unique element.
  • Class selectors target a group of elements.
  • The asterisk targets every element on the page.

Up Next

Continue your journey with the next topic.

Go to CSS How To