MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Revision 236892 of padding-top

  • Revision slug: CSS/padding-top
  • Revision title: padding-top
  • Revision id: 236892
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

Summary

The padding-top CSS property of an element sets the padding space required on the top of an element. The padding area is the space between the content of the element and it's border. A negative values is not allowed.

<style type="text/css"></style>
  • {{ Xref_cssinitial() }}: 0
  • Applies to: all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column
  • {{ Xref_cssinherited() }}: no
  • Percentages: refer to {{ Cssxref("width") }} of closest block-level ancestor
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: the percentage as specified or the absolute length

Syntax

padding-bottom: {{ Xref_csslength() }} | {{ Xref_csspercentage() }} | {{ Cssxref("inherit") }};

Values

<length>
Specifies a positive fixed width. See {{ Xref_csslength() }} for details.
<percentage>
A percentage with respect to the width of the containing block.

Examples

.content { padding-top: 5%; }
.sidebox { padding-top: 10px; } 

Specifications

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 1.0 (1.0) 4.0 3.5 1.0 (85)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

  • {{ CSS_Reference:Padding() }}

{{ languages( { "de": "de/CSS/padding-top", "ja": "ja/CSS/padding-top" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h3 id="Summary" name="Summary">Summary</h3>
<p>The <code>padding-top</code> <a href="/en/CSS" title="CSS">CSS</a> property of an element sets the padding space required on the top of an element. The <a href="/en/CSS/box_model#padding" title="http://developer.mozilla.org/en/CSS/Box_model#padding">padding area</a> is the space between the content of the element and it's border. A negative values is not allowed.</p>
<nobr>
<style type="text/css"><![CDATA[.cssprop {
  display:table;
  padding: 0.4em;
  border-left:0.15em solid;
  background-color:#eeeeff
}
.cssprop li {
 display:table-row;
 padding: 3px;
 margin:0;
}
.cssprop li dfn {
  display:table-cell;
  padding: 0 5px;
  border-bottom: none;
  cursor:inherit;
}

]]></style>
<ul class="cssprop"> <li><dfn>{{ Xref_cssinitial() }}:</dfn> <code>0</code></li> <li><dfn>Applies to:</dfn> all elements except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column</li> <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li> <li><dfn>Percentages:</dfn> refer to {{ Cssxref("width") }} of closest block-level ancestor</li> <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li> <li><dfn>{{ Xref_csscomputed() }}:</dfn> the percentage as specified or the absolute length</li>
</ul></nobr><h3 id="Syntax" name="Syntax">Syntax</h3>
<pre class="eval">padding-bottom: {{ Xref_csslength() }} | {{ Xref_csspercentage() }} | {{ Cssxref("inherit") }};
</pre>
<h3 id="Values" name="Values">Values</h3>
<dl> <dt>&lt;length&gt;</dt> <dd>Specifies a positive fixed width. See {{ Xref_csslength() }} for details.</dd> <dt>&lt;percentage&gt;</dt> <dd>A percentage with respect to the width of the containing block.</dd>
</dl>
<h3 id="Examples" name="Examples">Examples</h3>
<pre>.content { padding-top: 5%; }
.sidebox { padding-top: 10px; } 
</pre>
<h3 id="Specifications" name="Specifications">Specifications</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/CSS1#padding-bottom">CSS 1</a></li> <li><a class="external" href="http://www.w3.org/TR/CSS21/box.html#padding-properties">CSS 2.1 box</a></li> <li><a class="external" href="http://www.w3.org/TR/css3-box/#the-padding">CSS 3 box</a></li>
</ul>
<h3 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td>1.0</td> <td>1.0 (1.0)</td> <td>4.0</td> <td>3.5</td> <td>1.0 (85)</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody> </table>
</div>
<h3 id="See_also">See also</h3>
<ul>
  <li>{{ CSS_Reference:Padding() }}</li>
</ul>
<p>{{ languages( { "de": "de/CSS/padding-top", "ja": "ja/CSS/padding-top" } ) }}</p>
Revert to this revision