concept
top-layer — CSS reference
The top layer is a browser-managed ordered collection above ordinary document stacking contexts. Modal dialogs and shown popovers can enter it via their respective APIs; ordinary z-index cannot promote arbitrary elements into it. Top-layer elements can have a backdrop, and multiple entries have their own ordering.
Formal Syntax & Structure
css syntaxcss
dialog.showModal(); /* HTML API adds modal dialog to top layer */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:fixed;inset:0;width:auto;height:auto;z-index:2147483647}#d{position:fixed;inset:20px auto auto 20px;margin:0;width:100px;height:60px}</style><body><div id="p"><div id="a">Document overlay</div></div><dialog id="d">Top layer</dialog><script>d.showModal()</script></body></html>