concept

painting-order — CSS reference

Within a stacking context, its own background and border precede negative positioned contexts; normal-flow block backgrounds, floats, inline content and positioned zero/positive levels follow applicable painting phases. Nested contexts are handled recursively. This is a simplified overview, not the full painting algorithm.

Formal Syntax & Structure

css syntaxcss
Painting order (concept).

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,#b{position:absolute;left:20px;top:20px;width:90px;height:60px}#a{z-index:2}#b{z-index:1}#p{isolation:isolate}#a{z-index:-1}#b{z-index:0}</style><body><div id="p"><div id="a">A</div><div id="b">B</div></div></body></html>
CSS Reference