Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Element Selectors | Selecting and Targeting Elements
CSS Foundations

bookElement Selectors

index.html

index.html

style.css

style.css

copy

Element selectors in CSS allow you to target HTML elements based on their tag name. This means you can write a rule that applies to every occurrence of a particular element, such as p, h1, ul, or button, within your HTML document. Element selectors are especially useful when you want to give a consistent style to all elements of the same type, without having to add any classes or IDs.

To use an element selector, simply write the name of the element, then add your declaration block with curly braces. For example, writing p { color: blue; } in your CSS will make all <p> elements display blue text. This approach is ideal for setting global styles for headings, paragraphs, lists, and other basic HTML elements.

Element selectors are one of the simplest and most widely used types of selectors in CSS. They help you quickly establish a visual foundation for your site, making it easy to maintain a consistent look and feel. Keep in mind, however, that element selectors are broad—they will affect every matching element unless you use more specific selectors later.

question mark

Which CSS selector will target all <p> elements on a page?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 1

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Awesome!

Completion rate improved to 6.67

bookElement Selectors

Veeg om het menu te tonen

index.html

index.html

style.css

style.css

copy

Element selectors in CSS allow you to target HTML elements based on their tag name. This means you can write a rule that applies to every occurrence of a particular element, such as p, h1, ul, or button, within your HTML document. Element selectors are especially useful when you want to give a consistent style to all elements of the same type, without having to add any classes or IDs.

To use an element selector, simply write the name of the element, then add your declaration block with curly braces. For example, writing p { color: blue; } in your CSS will make all <p> elements display blue text. This approach is ideal for setting global styles for headings, paragraphs, lists, and other basic HTML elements.

Element selectors are one of the simplest and most widely used types of selectors in CSS. They help you quickly establish a visual foundation for your site, making it easy to maintain a consistent look and feel. Keep in mind, however, that element selectors are broad—they will affect every matching element unless you use more specific selectors later.

question mark

Which CSS selector will target all <p> elements on a page?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 1
some-alt