Thanks to visit codestin.com
Credit goes to www.cssportal.com

CSS Portal

CSS padding-left Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The padding-left property controls the amount of space placed between an element’s left border and its content, effectively pushing content inward from the left edge of the element’s content box. Because padding is part of the element’s inner box, backgrounds and hit-testing (clickable/touchable area) extend into that padded region, so increasing left padding both visually and interactively moves content away from the border while keeping the padded area inside the element. For layouts that adapt to writing direction, consider using the logical alternative padding-inline-start and the related flow direction set by direction.

In the context of the CSS box model, left padding changes how much room the element’s content has and therefore interacts with how the element’s overall size is calculated; that interaction is influenced by box-sizing. Padding differs from outside spacing such as margin-left because margins affect space outside the element and can participate in margin-collapsing rules between block-level boxes, whereas padding remains internal and never collapses with adjacent margins. Because padding is painted and part of the element’s interior, designers often use it to visually separate text or controls from borders while keeping those areas part of the element’s background and hit area.

Behavior with different display types can vary: on inline-level boxes, left padding shifts the inline box’s content inward without introducing a new block-level gap, while in table cells it contributes to the cell’s inner spacing and affects how cell content wraps. Left padding also reduces the available width for content inside the box, which can influence when and how scrolling or overflow happens—so it interacts functionally with overflow handling such as overflow. For convenience and consistency, left padding can be set individually or managed together with other sides using the shorthand padding, but remembering the physical nature of padding-left (always the left edge) helps avoid layout surprises in multilingual or right-to-left contexts.

Definition

Initial value
0
Applies to
All elements
Inherited
No
Computed value
<length> - the percentage as specified or the absolute length
Animatable
Yes
JavaScript syntax
object.style.paddingLeft

Interactive Demo

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff. Somewhere, beyond the veil of dusk, a coyote laughed, echoing through the stillness like a forgotten memory.

Syntax

padding-left: [ <length> | <percentage> ]

Values

  • <length>Specifies a positive fixed width.
  • <percentage>A percentage with respect to the width of the containing block.
  • inherit

Example

<body>
<h2>padding-left example</h2>
<div class="box no-padding">
<strong>No padding-left:</strong>
<p>This box has no left padding. Text starts at the left edge.</p>
</div>
<div class="box padded">
<strong>Padded (padding-left: 30px):</strong>
<p>This box has 30px left padding. Text is indented from the left edge.</p>
</div>
</body>
/* Example showing padding-left */
body {
  font-family: Arial, sans-serif;
  padding: 20px;
  background-color: #f7f7f7;
}

.box {
  border: 1px solid #ccc;
  background-color: #fff;
  margin: 12px 0;
  padding: 10px;
}

.no-padding {
  padding-left: 0;
}

.padded {
  padding-left: 30px;
}

Browser Support

The following information will show you the current browser support for the CSS padding-left property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!