CSS padding-bottom Property

CSS padding-bottom property sets the bottom side padding to HTML Element(s).

The syntax to specify a value for padding-bottom property is

padding-bottom: value;

The following table gives the possible values that could be given to padding-bottom property.

ValueDescriptionExamples
lengthAny valid CSS length unit. Refer CSS Length Units tutorial.padding-bottom: 10px;padding-bottom: 5pt;padding-bottom: 2cm;
Percentage ValuePadding in percent of the width of the containing element.padding-bottom: 20%;
initialSets padding-bottom to default value.padding-bottom: initial;
inheritInherits padding-bottom value from its parent element.padding-bottom: inherit;

Examples

In the following examples, we set bottom padding to HTML Element(s) with a few allowed values for padding-bottom property.

ADVERTISEMENT

padding-bottom property with CSS Length Units

In the following example, we apply padding-bottom property to paragraphs with a few different CSS Length Unit values.

index.html

Note: border and display properties have been specified only to understand the bounds of the HTML Elements and thus understand the extent of padding applied for these HTML Elements.

padding-bottom property with Percentage Values

In the following example, we apply padding-bottom property to paragraphs with a few different percentage values.

If padding-bottom is specified in percentage values, and if width of the HTML element changes, then the padding also changes. For example, try to resize the browser window, and observe the bottom padding for these HTML Elements.

index.html

padding-bottom property for a few HTML elements

In the following example, we take a few HTML elements like h1, p, a, span, and pre, and set padding-bottom for these HTML elements.

index.html

Conclusion

In this CSS Tutorial, we learned about padding-bottom property, and how to use this property for HTML Elements, with examples.