CSS Padding: The padding property in CSS is addressed to describe the space among the element border and the element content.
This property is quite different from the margin property of CSS because the margin property of CSS depicts the space over elements. The CSS background color affects the CSS padding property. It clears the space over the content.

Left, right, top, and bottom padding may be altered by the use of separate properties independently. We can also change every property by the use of the shorthand CSS padding property at once.

Padding Properties

PropertyDescription
paddingThis property is applied to set every property in just one declaration.
padding-leftThe padding-left property is referred to set an element’s left padding.
padding-rightThis property in CSS is applied to set an element’s eight padding.
padding-topThe padding-top property in CSS is employed to set an element’s top padding.
padding-bottomThis property in CSS is applied to set an element’s bottom padding.

Padding Values

ValueDescription
lengthIt can be used to describe fixed padding with em, px, and pt.
%It is used to describe padding with % of any containing element.

Padding Example

Let’s take a look on the following padding example it will help us to understand the padding property:

Output:

Pin It on Pinterest

Share This