property-value

position/relative — CSS reference

Offsets a box from its original layout position without reserving a new slot. It establishes an absolute-position containing block for descendants; a non-auto z-index establishes a stacking context.

Formal Syntax & Structure

css syntaxcss
position: relative;

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}#a{position:relative;top:12px;left:18px}</style><body><div id="p"><div id="a">A</div><div id="b">B</div></div></body></html>
CSS Reference