Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

CSS property `overlay`

`overlay` is a UA-controlled discrete property reflecting whether an element is in the top layer.

Version: CSS modules; captured CSSWG editor index includes draft and obsolete features requiring review

Syntax

none | auto

overlay is a UA-controlled discrete property reflecting whether an element is in the top layer.

The example opens a dialog with showModal(), tests :modal, and reports the computed overlay value.

Grammar: none | auto. This example does not replace wheel and touch testing on the target device.

Author CSS cannot force auto on an ordinary element; the property is mainly exposed for allow-discrete entry and exit transitions.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title><body><pre id="result"></pre><script>
const d=document.createElement("dialog");document.body.prepend(d);d.showModal();document.querySelector("#result").textContent="modal="+d.matches(":modal")+"; computed="+getComputedStyle(d).overlay;d.close();
</script></body></html>

Result

modal=true; computed=auto

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources