Selectors

In this lesson, we will get acquainted with selectors in CSS. Let's begin!

You can easily define what a rule in a style sheet does: it declares one or more property and value pairs to apply on a set of HTML nodes within the current document.

In this approach, selectors identify the part of the document that should be styled. Here, you’ll learn them through simple examples.

Tag, class, and ID selectors

The three most frequently used selector types are:

  1. the tag selector —applied to every occurrence of an HTML tag

  2. the class selector —applied to every occurrence of an HTML tag that has a specific value in its class attribute

  3. the ID selector - applied to the HTML tag with a specific identifier (the value of the ID ...