--- title: padding slug: Web/CSS/padding tags: - CSS - CSS Eigenschaft - CSS Innenabstand - CSS Referenz - Layout - Web translation_of: Web/CSS/padding --- <p>{{ CSSRef() }}</p> <h2 id="Übersicht">Übersicht</h2> <p>Die <code>padding</code> Eigenschaft ist eine Kurzform für die Innenabstände aller vier Seiten eines Elementes. Der Innenabstand ist der Bereich zwischen dem Inhalt und dem <a href="/de/CSS/border" title="de/CSS/border">Rahmen</a> (auch: <em>padding area</em>).</p> <p>{{cssinfo}}</p> <h2 id="Syntax">Syntax</h2> <pre class="eval">padding: [ <Längenangabe> | <Prozentzahl> ] {1,4} | inherit</pre> <h3 id="Werte">Werte</h3> <p>Es werden bis zu vier der folgenden Werte akzeptiert:</p> <dl> <dt><Längenangabe></dt> <dd>Legt eine bestimmte <a href="/de/CSS/Einheiten#L.c3.a4ngen" title="de/CSS/Einheiten#L.c3.a4ngen">Länge</a> fest. Negative Werte sind <strong>nicht</strong> erlaubt.</dd> <dt><Prozentzahl></dt> <dd>Ein <a href="/de/CSS/Einheiten#Prozent" title="de/CSS/Einheiten#Prozent">prozentualer</a> Wert, der sich auf die Breite des umschließenden Blocks (containing block) bezieht. Negative Werte <strong>nicht</strong> sind erlaubt.</dd> <dt>inherit</dt> <dd>Der Wert des Elternelements wird geerbt.</dd> <dt>Ein Wert</dt> <dd>Gilt für alle vier Seiten.</dd> <dt>Zwei Werte</dt> <dd>Der erste Wert bestimmt die <a href="/de/CSS/padding-top" title="de/CSS/padding-top">oberen</a> und <a href="/de/CSS/padding-bottom" title="de/CSS/padding-bottom">unteren</a> Abstände, der zweite Wert legt die Abstände <a href="/de/CSS/padding-right" title="de/CSS/padding-right">rechts</a> und <a href="/de/CSS/padding-left" title="de/CSS/padding-left">links</a> fest.</dd> <dt>Drei Werte</dt> <dd>Der erste Wert bestimmt den <a href="/de/CSS/padding-top" title="de/CSS/padding-top">oberen</a> Abstand, der zweite Wert legt die Abstände für <a href="/de/CSS/padding-right" title="de/CSS/padding-right">rechts</a> und <a href="/de/CSS/padding-left" title="de/CSS/padding-left">links</a> zusammen fest und der dritte Wert bestimmt den <a href="/de/CSS/padding-bottom" title="de/CSS/padding-bottom">unteren</a> Abstand.</dd> <dt>Vier Werte</dt> <dd>Für jede Seite können die Abstände einzeln festgelegt werden. In der Reihenfolge: <a href="/de/CSS/padding-top" title="de/CSS/padding-top">oben</a>, <a href="/de/CSS/padding-right" title="de/CSS/padding-right">rechts</a>, <a href="/de/CSS/padding-bottom" title="de/CSS/padding-bottom">unten</a>, <a href="/de/CSS/padding-left" title="de/CSS/padding-left">links</a>.</dd> </dl> <h3 id="Beispiele">Beispiele</h3> <pre>padding: 5%; /* 5% Abstand auf allen Seiten */ padding: 10px; /* 10px Abstand auf allen Seiten */ padding: 10px 20px; /* oben und unten 10px */ /* links und rechts 20px */ padding: 10px 3% 20px; /* oben 10px */ /* links und rechts 3% */ /* unten 20px */ padding: 1em 3px 30px 5px; /* oben 1em */ /* rechts 3px */ /* unten 30px */ /* links 5px */ </pre> <p style="border: outset; padding: 5% 1em;">border:outset; padding:5% 1em;</p> <h2 id="Livebeispiel" name="Livebeispiel">Livebeispiel</h2> <h3 id="HTML_Inhalt">HTML Inhalt</h3> <pre class="brush: html language-html"><code class="language-html"><span class="tag token"><span class="tag token"><span class="punctuation token"><</span>h4</span><span class="punctuation token">></span></span>Hallo Welt!<span class="tag token"><span class="tag token"><span class="punctuation token"></</span>h4</span><span class="punctuation token">></span></span> <span class="tag token"><span class="tag token"><span class="punctuation token"><</span>h3</span><span class="punctuation token">></span></span>Der Innenabstand ist in dieser Zeile anders.<span class="tag token"><span class="tag token"><span class="punctuation token"></</span>h3</span><span class="punctuation token">></span></span></code></pre> <h3 id="CSS_Inhalt">CSS Inhalt</h3> <pre class="brush: css language-css"><code class="language-css"><span class="selector token">h4 </span><span class="punctuation token">{</span> <span class="property token"> background-color</span><span class="punctuation token">:</span> green<span class="punctuation token">;</span> <span class="property token"> padding</span><span class="punctuation token">:</span> 50px 20px 20px 50px<span class="punctuation token">;</span> <span class="punctuation token">}</span> <span class="selector token">h3</span><span class="punctuation token">{</span> <span class="property token"> background-color</span><span class="punctuation token">:</span> blue<span class="punctuation token">;</span> <span class="property token"> padding</span><span class="punctuation token">:</span> 400px 50px 50px 400px<span class="punctuation token">;</span> <span class="punctuation token">}</span></code></pre> <p>{{ EmbedLiveSample('Livebeispiel') }}</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 Box', '#the-padding', 'padding') }}</td> <td>{{ Spec2('CSS3 Box') }}</td> <td>keine Änderung</td> </tr> <tr> <td>{{ SpecName('CSS2.1', 'box.html#propdef-padding', 'padding-top') }}</td> <td>{{ Spec2('CSS2.1') }}</td> <td>keine Änderung</td> </tr> <tr> <td>{{ Specname('CSS1', '#padding', 'padding') }}</td> <td>{{ Spec2('CSS1') }}</td> <td>Ursprüngliche Definition</td> </tr> </tbody> </table> <h2 id="Browser_Compatibility" name="Browser_Compatibility">Browserkompatiblität</h2> {{Compat("css.properties.padding")}} <h2 id="Siehe_auch">Siehe auch</h2> <ul> <li><a class="internal" href="/de/docs/Web/CSS/Boxmodell" title="en/CSS/box model">CSS Boxmodell</a></li> </ul>