aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/css/background-color/index.html
blob: ee695550a158b89fa3454070d64a5c90592ac790 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
title: background-color
slug: Web/CSS/background-color
tags:
  - CSS
  - CSS Eigenschaft
  - CSS Hintergrund
  - Grafik
  - Layout
  - Referenz
translation_of: Web/CSS/background-color
---
<div>{{CSSRef}}</div>

<h2 id="Übersicht">Übersicht</h2>

<p>Die <strong><code>background-color</code></strong> <a href="/de/docs/Web/CSS">CSS</a> Eigenschaft setzt die Hintergrundfarbe eines Elements, entweder durch einen Farbwert oder das Schlüsselwort <code>transparent</code>.</p>

<div>{{cssinfo}}</div>

<h2 id="Syntax">Syntax</h2>

<pre class="brush: css notranslate">/* Schlüsselwortwerte */
background-color: red;

/* Hexadezimalwert */
background-color: #bbff00;

/* RGB-Wert */
background-color: rgb(255, 255, 128);

/* HSLA-Wert */
background-color: hsla(50, 33%, 25%, 0.75);

/* Spezielle Schlüsselwortwerte */
background-color: currentColor;
background-color: transparent;

/* Globale Werte */
background-color: inherit;
background-color: initial;
background-color: unset;
</pre>

<h3 id="Werte">Werte</h3>

<dl>
 <dt><code>&lt;color&gt;</code></dt>
 <dd>Ist ein CSS {{cssxref("&lt;color&gt;")}} Wert, der die einheitliche Farbe des Hintergrunds beschreibt. Sogar wenn ein oder mehrere {{cssxref("background-image")}} definiert sind, kann diese Farbe die Darstellung durch Transparenzen in den Bildern beeinflussen. In CSS ist <code>transparent</code> eine Farbe.</dd>
</dl>

<h3 id="Formale_Syntax">Formale Syntax</h3>

{{csssyntax}}

<h2 id="Beispiele">Beispiele</h2>

<h3 id="HTML">HTML</h3>

<pre class="brush: html notranslate">&lt;div class="exampleone"&gt;
 Lorem ipsum dolor sit amet, consectetuer
&lt;/div&gt;

&lt;div class="exampletwo"&gt;
  Lorem ipsum dolor sit amet, consectetuer
&lt;/div&gt;

&lt;div class="examplethree"&gt;
  Lorem ipsum dolor sit amet, consectetuer
&lt;/div&gt;</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css; highlight:[2,7,12,17]; notranslate">.exampleone {
  background-color: teal;
  color: white;
}

.exampletwo {
  background-color: rgb(153,102,153);
  color: rgb(255,255,204);
}

.examplethree {
  background-color: #777799;
  color: #FFFFFF;
}
</pre>

<h3 id="Ergebnis">Ergebnis</h3>

<p>{{EmbedLiveSample("Beispiele","200","150")}}</p>

<h2 id="Spezifikationen">Spezifikationen</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Spezifikation</th>
   <th scope="col">Status</th>
   <th scope="col">Kommentar</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('CSS3 Backgrounds', '#background-color', 'background-color')}}</td>
   <td>{{Spec2('CSS3 Backgrounds')}}</td>
   <td>Obwohl das Schlüsselwort <code>transparent</code> technisch entfernt wurde, ändert dies nichts, da es als echter {{cssxref("&lt;color&gt;")}} integriert wurde.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS2.1', 'colors.html#propdef-background-color', 'background-color')}}</td>
   <td>{{Spec2('CSS2.1')}}</td>
   <td>Keine Änderung</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS1', '#background-color', 'background-color')}}</td>
   <td>{{Spec2('CSS1')}}</td>
   <td>Ursprüngliche Definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_Kompatibilität">Browser Kompatibilität</h2>

<p>{{Compat("css.properties.background-color")}}</p>

<h2 id="Siehe_auch">Siehe auch</h2>

<ul>
 <li>
  <p><a href="/de/docs/Web/Guide/CSS/mehrere_Hintergründe_verwenden">Mehrere Hintergründe</a></p>
 </li>
</ul>