CKTIS / CSS
padding-top — top inner spacing
padding-top sets spacing inside the top edge of a CSS box. It accepts a nonnegative length or percentage; the percentage is not calculated from the element’s height.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
padding-top: <length-percentage [0,∞]>;padding-top sets the thickness of the top padding area, between the content and border. Unlike margin-top, it creates space inside the border. It is a physical property: it targets the top regardless of writing direction.
Its initial value is 0, and it is not inherited. It accepts nonnegative lengths and percentages. Negative values and auto are invalid. The padding shorthand sets all four sides, including padding-top.
A percentage refers to the containing block’s logical width, not its height. With writing-mode: horizontal-tb, this is the horizontal width. Thus, in the example, 10% of 200px gives 20px, regardless of the content’s height.
Examples
<!doctype html>
<meta charset="utf-8">
<style>
.container { width: 200px; writing-mode: horizontal-tb; }
.box {
padding: 0;
padding-top: 10%;
background: #dceeff;
}
</style>
<div class="container">
<div class="box" id="box">Content</div>
</div>
<pre id="result"></pre>
<script>
document.getElementById('result').textContent =
getComputedStyle(document.getElementById('box')).paddingTop;
</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.