CSS Tag Selectors

Learn how to use CSS tag selectors to apply styles to all HTML elements of a specific type.

CSS Tag Selectors: Style by Name

In CSS, a tag selector allows you to target and style all HTML elements of a specific type, such as all `<h1>` headings or all `<p>` paragraphs.

The Syntax of Tag Selectors

The basic syntax for selecting a tag in CSS is: `tag { property: value; }`. For example, to make all `h1` headings blue: `h1 { color: blue; }`.

Why Use Tag Selectors?

Tag selectors are essential for applying basic, broad styles to a type of HTML element. This allows for a consistent look across your web page for all elements of a specific type.

Practice Zone


Interactive Test 1: Drag & Drop

Arrastra en el orden correspondiente.


Arrastra las opciones:

h1
color:
blue

Completa el código:

______
{______
______}

Interactive Test 2: Fill in the Blanks

Rellena los huecos en cada casilla.

h1 { color: ; }

Practice Example: Code Editor

Write CSS style so that all `h1` titles are red.

* Write the code below. Correct characters will be shown in green and incorrect ones in red.

h1 { color: red; }

Knowledge Check

Which of the following is a tag selector in CSS?