aboutsummaryrefslogtreecommitdiff
path: root/files/de/web/css/background-attachment/index.html
blob: 0b97feed124fec193a2c32322cb2759a4471e522 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---
title: background-attachment
slug: Web/CSS/background-attachment
tags:
  - CSS
  - CSS Background
  - CSS Eigenschaft
  - CSS Hintergrund
  - CSS Referenz
  - Referenz
translation_of: Web/CSS/background-attachment
---
<div>{{CSSRef}}</div>

<p>Die <a href="https://wiki.developer.mozilla.org/en-US/docs/Web/CSS">CSS</a> Eigenschaft <strong><code>background-attachment</code></strong>legt fest, ob die Position eines Hintergrundbildes innerhalb des {{glossary("viewport")}} fixiert ist, oder ob es mit seinem enthaltenden Block scrollt.</p>

<div>{{EmbedInteractiveExample("pages/css/background-attachment.html")}}</div>

<div class="hidden">Die Quelle für dieses interaktive Beispiel ist in einem GitHub-Repository gespeichert. Wenn Sie zum Projekt der interaktiven Beispiele beitragen möchten, klonen Sie bitte <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> und senden Sie uns eine Pull-Anfrage.</div>

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

<pre class="brush: css no-line-numbers notranslate">/* Keyword values */
background-attachment: scroll;
background-attachment: fixed;
background-attachment: local;

/* Global values */
background-attachment: inherit;
background-attachment: initial;
background-attachment: unset;
</pre>

<p>Die Eigenschaft <code>background-attachment</code> wird als einer der Schlüsselwortwerte aus der folgenden Liste angegeben.</p>

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

<dl>
 <dt><code>fixed</code></dt>
 <dd>Der Hintergrund ist relativ zum Ansichtsfenster fixiert. Selbst wenn ein Element über einen Bildlaufmechanismus verfügt, bewegt sich der Hintergrund nicht mit dem Element. (Dies ist nicht kompatibel mit {{cssxref("background-clip", "background-clip: text", "#text")}}.)</dd>
 <dt><code>local</code></dt>
 <dd>Der Hintergrund ist relativ zum Inhalt des Elements fixiert. Wenn das Element über einen Bildlaufmechanismus verfügt, wird der Hintergrund mit dem Inhalt des Elements gescrollt, und der Hintergrundmalbereich und der Hintergrundpositionierungsbereich sind relativ zum scrollbaren Bereich des Elements und nicht zum Rand, der sie umrahmt.</dd>
 <dt><code>scroll</code></dt>
 <dd>Der Hintergrund ist relativ zum Element selbst fixiert und scrollt nicht mit seinem Inhalt. (Er ist effektiv an den Rand des Elements gebunden).</dd>
 <dt>{{cssxref("&lt;initial&gt;")}}</dt>
 <dd>Setzt den Standardwert für diese Eigenschaft</dd>
 <dt>{{cssxref("&lt;inherit&gt;")}}</dt>
 <dd>Diese Eigenschaft erbt den Wert von seinem Elternelement.</dd>
</dl>

<h2 id="Formale_Definition">Formale Definition</h2>

<p>{{cssinfo}}</p>

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

{{csssyntax}}

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

<h3 id="Simple_example" name="Simple_example">Einfaches Beispiel</h3>

<h4 id="HTML">HTML</h4>

<pre class="brush: html notranslate">&lt;p&gt;
  There were doors all round the hall, but they were all locked; and when
  Alice had been all the way down one side and up the other, trying every
  door, she walked sadly down the middle, wondering how she was ever to
  get out again.
&lt;/p&gt;</pre>

<h4 id="CSS">CSS</h4>

<pre class="brush:css; highlight:[3]; notranslate">p {
  background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif");
  background-attachment: fixed;
}</pre>

<h4 id="Ergebnis">Ergebnis</h4>

<p>{{EmbedLiveSample("Simple_example")}}</p>

<h3 id="Multiple_background_images" name="Multiple_background_images">Mehrere Hintergründe</h3>

<p>Diese Eigenschaft unterstützt mehrere Hintergrundbilder. Sie können für jeden Hintergrund ein anderes <code>&lt;attachment&gt;</code> , durch Kommata getrennt, angeben. Jedes Bild, vom ersten bis zum letzten, wird dem entsprechenden <code>&lt;attachment&gt;</code> Typ zugeordnet.</p>

<h4 id="HTML_2">HTML</h4>

<pre class="brush: html notranslate">&lt;p&gt;
  There were doors all round the hall, but they were all locked; and when
  Alice had been all the way down one side and up the other, trying every
  door, she walked sadly down the middle, wondering how she was ever to
  get out again.

  Suddenly she came upon a little three-legged table, all made of solid
  glass; there was nothing on it except a tiny golden key, and Alice's
  first thought was that it might belong to one of the doors of the hall;
  but, alas! either the locks were too large, or the key was too small,
  but at any rate it would not open any of them. However, on the second
  time round, she came upon a low curtain she had not noticed before, and
  behind it was a little door about fifteen inches high: she tried the
  little golden key in the lock, and to her great delight it fitted!
&lt;/p&gt;</pre>

<h4 id="CSS_2">CSS</h4>

<pre class="brush:css; highlight:[3]; notranslate">p {
  background-image: url("https://mdn.mozillademos.org/files/12057/starsolid.gif"),
      url("https://mdn.mozillademos.org/files/12059/startransparent.gif");
  background-attachment: fixed, scroll;
  background-repeat: no-repeat, repeat-y;
}</pre>

<h4 id="Ergebnis_2">Ergebnis</h4>

<p>{{EmbedLiveSample("Multiple_background_images")}}</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', '#the-background-attachment', 'background-attachment')}}</td>
   <td>{{Spec2('CSS3 Backgrounds')}}</td>
   <td>Das Kurzformat-Eigenschaft wurde erweitert, um mehrere Hintergründe und den <code>local</code> Wert zu unterstützen.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS2.1', 'colors.html#propdef-background-attachment', 'background-attachment')}}</td>
   <td>{{Spec2('CSS2.1')}}</td>
   <td>Keine wesentliche Änderung.</td>
  </tr>
  <tr>
   <td>{{SpecName('CSS1', '#background-attachment', 'background-attachment')}}</td>
   <td>{{Spec2('CSS1')}}</td>
   <td>Keine wesentliche Änderung.</td>
  </tr>
 </tbody>
</table>

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

<div class="hidden">Die Kompatibilitätstabelle auf dieser Seite wird aus strukturierten Daten generiert. Wenn Sie zu den Daten beitragen möchten, besuchen Sie bitte https://github.com/mdn/browser-compat-data und senden Sie uns eine Pull-Anfrage.</div>

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

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

<ul>
 <li><a href="/de/CSS/background" title="de/CSS/background"><code>background</code></a>, <a href="/de/CSS/background-clip" title="de/CSS/background-clip"><code>background-clip</code></a>, <a href="/de/CSS/background-color" title="de/CSS/background-color"><code>background-color</code></a>, <a href="/de/CSS/background-image" title="de/CSS/background-image"><code>background-image</code></a>, <a href="/de/CSS/background-origin" title="de/CSS/background-origin"><code>background-origin</code></a>, <a href="/de/CSS/background-position" title="de/CSS/background-position"><code>background-position</code></a>, <a href="/de/CSS/background-repeat" title="de/CSS/background-repeat"><code>background-repeat</code></a>, <a href="/de/CSS/background-size" title="de/CSS/background-size"><code>background-size</code></a></li>
 <li><a href="/de/CSS/-moz-background-inline-policy" title="de/CSS/-moz-background-inline-policy"><code>-moz-background-inline-policy</code></a></li>
</ul>