padding-left
Quick Summary for padding-left
Code Usage for padding-left
/* <length> values */ padding-left: 0.5em; padding-left: 0; padding-left: 2cm; /* <percentage> value */ padding-left: 10%; /* Global values */ padding-left: inherit; padding-left: initial; padding-left: revert; padding-left: unset;
More Details for padding-left
padding-left
The padding-left CSS property sets the width of the padding area to the left of an element.
An element's padding area is the space between its content and its border.
Note: The padding property can be used to set paddings on all four sides of an element with a single declaration.
Syntax
/* <length> values */ padding-left: 0.5em; padding-left: 0; padding-left: 2cm; /* <percentage> value */ padding-left: 10%; /* Global values */ padding-left: inherit; padding-left: initial; padding-left: revert; padding-left: unset; The padding-left property is specified as a single value chosen from the list below. Unlike margins, negative values are not allowed for padding.
Values
<length> The size of the padding as a fixed value. Must be nonnegative.
<percentage> The size of the padding as a percentage, relative to the width of the containing block. Must be nonnegative.
Formal definition
| Initial value | 0 |
|---|---|
| Applies to | all elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. It also applies to ::first-letter and ::first-line. |
| Inherited | no |
| Percentages | refer to the width of the containing block |
| Computed value | the percentage as specified or the absolute length |
| Animation type | a length |
Formal syntax
<length> | <percentage>
Examples
Setting left padding using pixels and percentages
.content { padding-left: 5%; } .sidebox { padding-left: 10px; } Specifications
| Specification |
|---|
| CSS Box Model Module Level 3 # padding-physical |
See also
Introduction to the CSS basic box modelpadding-top, padding-right, padding-bottom and the padding shorthand The mapped logical properties: padding-block-start, padding-block-end, padding-inline-start, and padding-inline-end and the shorthands padding-block and padding-inline Last modified: Aug 12, 2021, by MDN contributors
Select your preferred language English (US)DeutschFrançais日本語한국어Português (do Brasil)Русский中文 (简体) Change language Posted in
12:22 am, February 22, 2022
Add Comment
Other Items in CSS
rgb()
rgba()
:right
right
@right-bottom
:root
rotate
rotate()
rotate3d()
rotateX()
rotateY()
rotateZ()
row-gap
ruby-align
ruby-position
saturate()
scale
scale()
scale3d()
scaleX()
scaleY()
scaleZ()
:scope
scroll-behavior
scroll-margin
scroll-margin-block
scroll-margin-block-end
scroll-margin-block-start
scroll-margin-bottom
scroll-margin-inline
scroll-margin-inline-end
scroll-margin-inline-start
scroll-margin-left
scroll-margin-right
scroll-margin-top
scroll-padding
scroll-padding-block
scroll-padding-block-end
scroll-padding-block-start
scroll-padding-bottom
scroll-padding-inline
scroll-padding-inline-end
scroll-padding-inline-start
scroll-padding-left
scroll-padding-right
scroll-padding-top
scroll-snap-align
scroll-snap-stop
scroll-snap-type
@scroll-timeline