CKTIS / CSS
CSS property `padding`
`padding` sets the inner space between the content box and border on all four sides.
Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review
Syntax
<'padding-top'>{1,4}padding sets the inner space between the content box and border on all four sides.
The example measures the border box and child position after applying the spacing.
Grammar: <'padding-top'>{1,4}.
Padding enlarges a content-box sized box; percentages resolve against the containing block inline size and negative values are invalid.
Examples
<!doctype html><html lang="en"><meta charset="utf-8"><title>CKTIS CSS example</title><body><pre id="result"></pre><script>const x=document.createElement("div"),c=document.createElement("i");document.body.prepend(x);x.append(c);x.style.cssText="box-sizing:content-box;width:80px;height:40px;padding:10px 20px";c.style.cssText="display:block;width:10px;height:10px";const a=x.getBoundingClientRect(),b=c.getBoundingClientRect();document.querySelector("#result").textContent="box="+Math.round(a.width)+"x"+Math.round(a.height)+"; child=("+Math.round(b.left-a.left)+","+Math.round(b.top-a.top)+"); computed="+getComputedStyle(x).padding;</script></body></html>Result
box=120x60; child=(20,10); computed=10px 20px
The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.