CSS Reference ยท Box Model and Sizing
The padding-left property
Reference for the CSS padding-left property: syntax, values, percentages, indenting content and list markers, examples and browser support.
The padding-left property sets the space between an element's content and its left border. Because it sits inside the border, the background (and any left border) stays where it is while the text moves inward.
CSS
blockquote { padding-left: 1rem; border-left: 4px solid #94a3b8; }
Try it
Syntax
CSS
padding-left: <length> | <percentage>
- Initial value:
0 - Applies to: all elements except internal table row groups, header groups, footer groups, rows and column groups
- Inherited: no
- Percentages: relative to the width of the containing block
- Animatable: yes
- Computed value: the percentage as specified or the absolute length
Values
| Value | Description |
|---|---|
<length> |
A fixed size such as 1rem or 16px. Must not be negative. |
<percentage> |
A share of the containing block's width. |
Usage notes
- Lists. Browsers indent
<ul>and<ol>with a defaultpadding-left(usually 40px). Markers are drawn outside the content box, so removing the padding can push bullets out of view. Setlist-style-position: insideor keep some padding. - Indent text, not the box. To move the element itself, use
margin-left. Padding keeps the background and border in place. - Width. With
content-box, left padding makes the box wider; withborder-box, it shrinks the content area. - Right-to-left text. Use
padding-inline-startso the indent follows the text direction. - Form controls. Padding inside inputs and selects controls how far the text sits from the edge; set a matching value on
padding-rightfor a symmetric look.
Browser support
Supported in every browser.
Related
paddingโ the shorthandpadding-right,padding-top,padding-bottommargin-left- Lessons: Padding, Lists