From the course: CSS Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Type and universal selectors

Type and universal selectors - CSS Tutorial

From the course: CSS Essential Training

Type and universal selectors

- [Instructor] In CSS, selectors are used to select specific HTML elements and apply styles to them. Different types of selectors are used to determine which element the style should be applied to. Let's start by taking a look at how to use two basic selectors, type and universal. Type selectors are sometimes called an element selector, and they match to HTML elements by using the element name but without the angled brackets. For example, to apply a style to all the h2 elements on your webpage, use h2 as the selector. The universal selector can be used to select every single element in the whole document. The syntax is represented by a single asterisk. Using the universal selector can impact performance since it applies the styles to all elements on the page which is why it's not used very often. There are some special use cases which we'll discuss in more detail later in the course. Let's practice using selectors with a…

Contents