totn CSS

CSS: padding-bottom property

This CSS tutorial explains how to use the CSS property called padding-bottom with syntax and examples.

Description

The CSS padding-bottom property defines the padding space on the bottom of an element.

Syntax

The syntax for the padding-bottom CSS property is:

padding-bottom: value;

Parameters or Arguments

value

The padding space to apply to the bottom of the element. It can be one of the following:

Value Description
fixed Fixed value expressed in px, em, ...
div { padding-bottom: 6px; }
div { padding-bottom: 4em; }
percentage Percentage value
div { padding-bottom: 5%; }
inherit Element will inherit the padding-bottom from its parent element
div { padding-bottom: inherit; }

Note

  • The value in the CSS padding-bottom property can be expressed as either a fixed value or as a percentage.
  • Negative values are not allowed in the CSS padding-bottom property.
  • When the value is provided as a percentage, it is relative to the width of the containing block.
  • See also padding, padding-top, padding-left, and padding-right.

Browser Compatibility

The CSS padding-bottom property has basic support with the following browsers:

  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example

We will discuss the padding-bottom property below, exploring examples of how to use this property in CSS with a fixed value as well as a percentage value.

Using Fixed Value

Let's look at a CSS padding-bottom example where we have provided the value as a fixed value.

div { padding-bottom: 5px; }

In this CSS padding-bottom example, we have provided a value of 5px which would apply to the bottom of the element.

You can also express the padding-bottom property in em's.

For example:

div { padding-bottom: 2em; }

In this example, we have provided a value of 2em which would apply to the bottom of the element.

Using Percentage

Let's look at a CSS padding-bottom example where we have provided the value as a percentage.

div { padding-bottom: 2%; }

In this CSS padding-bottom example, we have provided a value of 2% which would apply to the bottom of the element.