Skip to: content, navigation

by Tommy Olsson and Paul O’Brien

padding-bottom (CSS property)

Browser support full matrix
IE6+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full
Spec
Inherited Initial Version
No 0 CSS1, 2.1

Example

This style rule assigns a 2em padding to the bottom side of paragraphs within the element with ID "example":

#example p {
  padding-bottom: 2em;
}

Try it yourself!View all demos

Description

The padding-bottom property sets the padding to the bottom side of an element using the value specified.

Padding is the area that’s sandwiched between an element’s borders and its content. Any background image or background color that’s applied to the element will extend across the padding area. Refer to The CSS Box Model for an in-depth discussion of how padding is accommodated within the CSS box model.

When vertical padding (padding-top and padding-bottom) is used on an inline, non-replaced element, it can cause the overlapping of elements above and below that element in cases where the padding causes the element in question to exceed the line height. See Inline Formatting for more information.

Value

The property takes a CSS length (px, pt, em, and so on) or a percentage of the width of the element’s containing block. Note that even for top and bottom padding the percentage value will refer to the width of the containing block. Negative length values are not allowed.

In CSS2.1, if the containing block’s width depends on an element with percentage padding, the resulting layout is undefined.

Compatibility

IE5.5Buggy
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

Internet Explorer versions up to and including 5.5 (and IE6 and IE7 when in quirks mode) incorrectly apply padding inside the stated width, thus reducing the space available for content—see The Internet Explorer 5 Box Model.

Internet Explorer up to and including version 6 will often need a position:relative; declaration added to inline elements in order to show the full amount of vertical padding.

Internet Explorer for Windows versions up to and including 7 don’t support the value inherit.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters