concept

scrollport — CSS reference

The scrollport is the viewport through which a scroll container exposes its scrollable overflow, generally coinciding with its padding box. It is distinct from the entire scrollable content. Sticky positioning uses the nearest scrollport for its inset constraints.

Formal Syntax & Structure

css syntaxcss
overflow: auto;

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{overflow:auto;height:100px}#a{position:sticky;top:10px}</style><body><div id="p"><div style="height:50px"></div><div id="a">Sticky</div><div style="height:300px"></div></div></body></html>
CSS Reference