Bild zum Thema

CSS: "color"

html css php mysql javascript
Bild zum Thema

CSS: "color"

Definition

Status: Aktueller Standard


Das Tag "color" steht für color (Farbe).
Die Property "color" bezieht sich immer auf die Schriftfarbe eines Elements. Sofern Kind-Elemente keine eigene Deklaration haben bekommen sie diese Property vererbt.

Syntax

Selektor {color: Farbangabe}

Optionen

Farbnamen

siehe Farbtabelle


hexadezimal

#ffffff


RGB

rgb(255, 255, 255)


HSL

hsl(0, 0%, 100%)


Transparenz

rgba(255, 255, 255, 0.5)


Syntax

Selektor {color: Farbangabe}

Beispiele

= Tag
= Selektor
= Wert
Wichtig!
= Wichtig!
Beispiel color

Der Code:
<style>
.rot
  {color: red;}
.hexfarbe
  {color: #1E90FF; /* HEX */}
.hslfarbe
  {color: hsl(120, 70%, 40%); /* HSL */}
.rgbafarbe
  {color: rgba(255, 165, 0, 0.8); /* RGBA */}
.lila
  {color:purple;}
</style>

<p class="rot">Mein Text hat nun die Farbe Rot</p>
<p class="hexfarbe">Mein Text hat nun die Farbe Blau (#1E90FF)</p>
<p class="hslfarbe">Mein Text hat nun die Farbe Grün (HSL)</p>
<p class="rgbafarbe">Mein Text hat nun die Farbe Orange (RGBA)</p>
<p class="lila">Mein Text hat nun die Farbe Lila</p>

Ergebnis:
Ergebnis: <color>-Demo 1
---