Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

inset-inline — CSS property

`inset-inline` sets both inline-axis offsets of a positioned element against its containing block.

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

Syntax

<'top'>{1,2}

inset-inline sets both inline-axis offsets of a positioned element against its containing block.

The example places an absolutely positioned child in a 100×60 px box and reports its x/y coordinates.

The accepted grammar is <'top'>{1,2}; global values still participate in the cascade.

Offsets do not move a position:static element; logical sides change with writing-mode and direction.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
document.body.innerHTML='<div id="c"><i id="x"></i></div><pre id="result"></pre>';const c=document.querySelector("#c"),x=document.querySelector("#x");c.style.cssText="position:relative;width:100px;height:60px";x.style.cssText="position:absolute;width:20px;height:10px";x.style.setProperty("inset-inline","15px 25px");const a=c.getBoundingClientRect(),b=x.getBoundingClientRect();document.querySelector("#result").textContent="child=("+Math.round(b.left-a.left)+","+Math.round(b.top-a.top)+"); computed="+getComputedStyle(x).getPropertyValue("inset-inline").trim();
</script></body></html>

Result

child=(15,0); computed=15px 25px

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources