property

inset — CSS reference

Physical shorthand for top, right, bottom and left. One value applies to all four; two mean vertical/horizontal; three mean top/horizontal/bottom. It is not a logical shorthand. Opposite non-auto insets can stretch an auto-sized absolute box, subject to sizing rules.

Formal Syntax & Structure

css syntaxcss
<'top'>{1,4}

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS positioning lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#p{width:240px;height:160px;background:#e6eef2} #a{width:60px;height:30px;background:#128579} #b{height:20px;background:#adcde8}#p{position:relative}#a{position:absolute;inset:10px 20px;width:auto;height:auto}</style><body><div id="p"><div id="a">A</div><div id="b">B</div></div></body></html>
CSS Reference