Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

padding-right — right-side padding

`padding-right` sets the distance from the right content edge to the right padding edge, excluding any border thickness. It accepts a nonnegative length or percentage.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

padding-right: <length-percentage [0,∞]>;

padding-right sets the thickness of the right padding: spacing inside the border, not margin outside it. It targets the physical right side, not the logical end of text.

It accepts a nonnegative length or percentage; negative values and auto are invalid. Its initial value is 0; it is not inherited. Percentages refer to the containing block’s logical width, not the element’s own width.

The padding shorthand sets all four sides. In the example, padding: 0 clears the padding, then padding-right: 10% sets the right side to 20px: 10% of 200px.

Examples

<!doctype html>
<meta charset="utf-8">
<style>
  .container { width: 200px; writing-mode: horizontal-tb; }
  .box { padding: 0; padding-right: 10%; background: lightblue; }
</style>
<div class="container"><div class="box">CSS</div></div>
<script>
  console.log(getComputedStyle(document.querySelector('.box')).paddingRight);
</script>

Result

20px

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources