🔧 AI Nachrichten Debian is Voting on Whether to Allow AI-Assisted Contributions(23.08.2026 um 09:34 Uhr)
🔧 AI Nachrichten The Linux Kernel Is Approaching 2,000 CVEs Per Release(29.08.2026 um 20:00 Uhr)
⚠️ Malware / Trojaner / VirenCitrix Adds a Linux-Powered Escape Hatch For Compromised Windows PCs(30.08.2026 um 17:34 Uhr)
🔧 ProgrammierungZaku 26.0 beta - Local-first, open-source API client(11.09.2026 um 22:38 Uhr)
🔧 Programmierung[$] Stabilizing Rust's never type(08.09.2026 um 15:34 Uhr)
🕵️ SicherheitslückenForgejo 16.0.4 and 15.0.8 address critical security vulnerability(10.09.2026 um 22:05 Uhr)
🔧 AI Nachrichten Debian is Voting on Whether to Allow AI-Assisted Contributions(23.08.2026 um 09:34 Uhr)
🔧 AI Nachrichten The Linux Kernel Is Approaching 2,000 CVEs Per Release(29.08.2026 um 20:00 Uhr)
⚠️ Malware / Trojaner / VirenCitrix Adds a Linux-Powered Escape Hatch For Compromised Windows PCs(30.08.2026 um 17:34 Uhr)
🔧 ProgrammierungZaku 26.0 beta - Local-first, open-source API client(11.09.2026 um 22:38 Uhr)
🔧 Programmierung[$] Stabilizing Rust's never type(08.09.2026 um 15:34 Uhr)
🕵️ SicherheitslückenForgejo 16.0.4 and 15.0.8 address critical security vulnerability(10.09.2026 um 22:05 Uhr)

🔧 Programmierung 🕛 vor 2 Jahren 3 Min Lesezeit
0

BASIC CSS SELECTORS

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

CSS selectors are used to target specific HTML elements and apply styles to them. There are a couple of ways we can be specific about the element we intend to select. In this chapter, we are going to focus on four basic selection methods.






1. Universal selector (*)



Universal selector is used to target all elements in the page at once. This selector is usually useful in cases of some basic formatting. Most common use of the universal selector is to remove default margins and paddings.

Example




CODE
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}










2. Selecting by element name



With this approach, all elements of the one named by the selector will be styled accordingly. This will only exclude those selected differently as we will see in future examples.

Code sample:

HTML




CODE
<h3>this is heading 1</h3>
<p>this is paragraph 1</p>
<p>this is paragraph 2</p>
<p>this is paragraph 3</p>
<h3>this is heading 2</h3>
<p>this is paragraph 4</p>
<p>this is paragraph 5</p>







CSS




CODE
body{
background: lightgray;
}
h3{
color: blue;
}
p{
color: red;

}







Result








4. Selecting by class



Class works kind of similar to id, but in the case of class, there could be more than one element with the same class name. To style an element with a class name, use the class attribute to give it a name in HTML, then use the . symbol before that name, when selecting in CSS.



Code sample

HTML




CODE
    <h3 >this is heading 1</h3>
<p class="pink">this is paragraph 1</p>
<p class="pink" >this is paragraph 2</p>
<p class="pink">this is paragraph 3</p>
<h3>this is heading 2</h3>
<p id="unique">this is paragraph 4</p>
<p>this is paragraph 5</p>







CSS




CODE
.pink{
background: pink;
}
body{
background: lightgray;
}
h3{
color: blue;
}
p{
color: red;

}







Result



Image description






Conclusion



Each selector type has its own purpose and usage. Understanding how to use each selector is crucial for effective HTML styling and layout control. Proper use of selectors can help create visually appealing and well-structured web pages, making it easier for users to interact with and understand the content presented.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Debian is Voting on Whether to Allow AI-Assisted Contributions
1 Quelle
The Linux Kernel Is Approaching 2,000 CVEs Per Release
1 Quelle
Citrix Adds a Linux-Powered Escape Hatch For Compromised Windows PCs
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten BASIC CSS SELECTORS

Thematisch verwandte Begriffe: BASIC, SELECTORS · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...