Want to share your CSS expertise with others? Apply to the MDN Fellowship by April 1! http://mzl.la/MDNFellowship

mozilla

Revision 293112 of padding-top

  • Revision slug: CSS/padding-top
  • Revision title: padding-top
  • Revision id: 293112
  • 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. Negative values are invalid.

  • {{ Xref_cssinitial() }}: 0
  • Applies to: all elements except those with a {{ cssxref("display") }} of 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

Specification Status Comment
{{ SpecName('CSS3 Box', '#the-padding', 'padding-top') }} {{ Spec2('CSS3 Box') }} No change.
{{ SpecName('CSS3 Transitions', '#animatable-css', 'padding-top') }} {{ Spec2('CSS3 Transitions') }} Defines padding-top as animatable.
{{ SpecName('CSS2.1', 'box.html#padding-properties', 'padding-top') }} {{ Spec2('CSS2.1') }} No change.
{{ Specname('CSS1', '#padding-top', 'padding-top') }} {{ Spec2('CSS1') }} Initial definition.

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() }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary" name="Summary">Summary</h2>
<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. Negative values are invalid.</p>
<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}:</dfn> <code>0</code></li>
  <li><dfn>Applies to:</dfn> all elements except those with a {{ cssxref("display") }} of <code>table-row-group</code>, <code>table-header-group</code>, <code>table-footer-group</code>, <code>table-row</code>, <code>table-column-group</code> and <code>table-column</code></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>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<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>
<h2 id="Examples" name="Examples">Examples</h2>
<pre class="brush: css">
.content { padding-top: 5%; }
.sidebox { padding-top: 10px; } 
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSS3 Box', '#the-padding', 'padding-top') }}</td>
      <td>{{ Spec2('CSS3 Box') }}</td>
      <td>No change.</td>
    </tr>
    <tr>
      <td>{{ SpecName('CSS3 Transitions', '#animatable-css', 'padding-top') }}</td>
      <td>{{ Spec2('CSS3 Transitions') }}</td>
      <td>Defines <code>padding-top</code> as animatable.</td>
    </tr>
    <tr>
      <td>{{ SpecName('CSS2.1', 'box.html#padding-properties', 'padding-top') }}</td>
      <td>{{ Spec2('CSS2.1') }}</td>
      <td>No change.</td>
    </tr>
    <tr>
      <td>{{ Specname('CSS1', '#padding-top', 'padding-top') }}</td>
      <td>{{ Spec2('CSS1') }}</td>
      <td>Initial definition.</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>
<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&nbsp;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>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{ CSS_Reference:Padding() }}</li>
</ul>
Revert to this revision