W3docs

CSS padding-bottom Property

This CSS property is used to specify the padding space on the bottom of an element. See more about property values in use.

The padding-bottom property sets the padding space on the bottom of an element. It defines the space between the element’s content and its bottom border.

The element’s padding contributes to computing the height of an element. Specifically, padding-bottom increases the total height by adding space below the content. If you use the “border-box” value of the box-sizing property, the total height calculation changes so that the padding is included within the specified height.

Info

Negative values are invalid.

Info

This property doesn't have any effect on inline elements, like <span>.

Initial Value0
Applies toAll elements. An exception is made when the display property is set to table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. It also applies to ::first-letter.
InheritedNo.
AnimatableYes. Padding space is animatable.
VersionCSS1
DOM Syntaxelement.style.paddingBottom = "5%";

Syntax

Syntax of CSS padding-bottom Property

padding-bottom: length | % | initial | inherit;

Example of the padding-bottom property:

Example of CSS padding-bottom Property with px value

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p {
        border: 2px solid #000;
        color: #1c87c9;
        padding-bottom: 40px;
      }
    </style>
  </head>
  <body>
    <h2>Padding-bottom property example</h2>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
  </body>
</html>

Result

CSS padding-bottom Property

Example of the padding-bottom property with the "length" value:

Example of CSS padding-bottom Property with cm value

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p {
        border: 2px solid #000;
        color: #1c87c9;
        padding-bottom: 2cm;
      }
    </style>
  </head>
  <body>
    <h2>Padding-bottom property example</h2>
    <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
  </body>
</html>

Values

ValueDescriptionPlay it
lengthIt sets the bottom padding in px, pt, cm, etc. Its initial value is 0.Play it »
%It sets bottom padding in percent of the width of the containing block.Play it »
initialMakes the property use its default value.Play it »
inheritInherits the property from its parent element.

Practice

Practice

What is the purpose of the 'padding-bottom' property in CSS?