You are here: Reference > CSS > properties > padding-top

padding-top property

Browser support:
Specifies the space between an element's top border and its contents.
With the padding-top property you can specify the distance between the top border-top and the element's content.
JavaScript page for this property: paddingTop. You can find other example(s) there.

Possible values:

 One of the following values: 
Takes the value of this property from the computed style of the parent element.
space in non-negative length
The space in length units. For the supported length units, see the length page.
space in non-negative percentage
The space is the specified percentage of the width of the parent element.
Default: 0.

Example HTML code 1:

This example illustrates the use of the padding-top, border and margin properties:
        .outer {
            border: 1px solid #ffffff;
            background-color: #ffb08a;
        .middle {
            margin: 20px;
            padding-top: 20px;
            border: 10px solid #000000;
            background-color: #ceb379;
        .inner {
            height: 10px;
            border: 1px solid #ffffff;
            background-color: #ffffff;
    <table cellpadding="0px" cellspacing="10px">
            <td style="background-color: #ffb08a;">&nbsp;</td>
            <td style="background-color: #000000;">&nbsp;</td>
            <td style="background-color: #ceb379;">&nbsp;</td>
    <div class="outer">
        <div class="middle">
            <div class="inner"></div>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content