concept

safe-area-insets — CSS reference

Safe-area variables describe insets needed to keep content in the unobscured viewport region. An inset may be zero, which does not activate fallback. Combine it with normal spacing using max() or calc(). Device shape and viewport configuration influence the result.

Formal Syntax & Structure

css syntaxcss
padding-top: env(safe-area-inset-top, 0px);

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS substitution lab</title><style>body {margin:0} .sample {height:12px;background:#006050}#parent {width:300px} .sample {width:40px;height:30px;margin-bottom:4px;color:white}#a{padding-top:env(safe-area-inset-top,0px)} #b{padding-top:max(12px,env(safe-area-inset-top,0px))}</style><body><div id="parent"><div id="a" class="sample">A</div><div id="b" class="sample">B</div></div></body></html>
CSS Reference