The Element.checkVisibility() method returns a boolean: whether the element is potentially visible (MDN). By default it is false when the element has no layout box (for example display: none / contents) or when content-visibility: hidden applies.
Pass the required arguments shown below. Check return values and browser support before you rely on the result.
Syntax
Call el.checkVisibility. Start with this line.
JavaScript
el.checkVisibility(options?)
Call
What it does
el.checkVisibility(options?)
Primary signature.
el.checkVisibility(...)
Call with the arguments your case needs.
Built into the browser. Call checkVisibility(...) on an Element — no import required.
Library declarations
JavaScript
el.checkVisibility(options?)
Parameters
Parameter
Description
options
Optional. Extra CSS visibility rules
Return Value
Return Value
Description
*
true or false
JavaScript Examples
Example 1 — Default Check
Compare a normal element with display: none.
JavaScript
const a = document.getElementById("a");
const b = document.getElementById("b");
const out = document.getElementById("out");
b.style.display = "none";
out.textContent =
"a=" + a.checkVisibility() +
" b=" + b.checkVisibility();
Detect the API. Older browsers may not have the method.
Prefer the standard check. Use options that match your visibility rules.
Fall back carefully. A non-zero rect is only a rough heuristic.
Keep one helper. Call sites stay simple either way.
Compatibility
Browser Support
Element.checkVisibility() is Baseline Widely available on MDN (across browsers since March 2024). It is not Deprecated, Experimental, or Non-standard. Feature-detect if you support older browsers.
✓ Baseline Widely available
Element.checkVisibility()
Standard “potentially visible” check for DOM elements. Widely available since 2024.
2024+Widely available
Google Chrome105+
Supported
Mozilla Firefox106+
Supported
Apple Safari17.4+
Supported
Microsoft Edge105+
Supported
Opera91+
Supported
Internet ExplorerNot supported
Unavailable
checkVisibility()Baseline
Bottom line: Safe for modern browsers. Detect and fall back when targeting older engines.
Frequently Asked Questions
It returns a boolean indicating whether the element is potentially visible (MDN). By default it checks for an associated layout box and whether content-visibility: hidden applies. Optional flags can also test opacity: 0, visibility: hidden/collapse, and content-visibility: auto skip rendering.
No. MDN marks Element.checkVisibility() as Baseline Widely available (across browsers since March 2024). It is not Deprecated, Experimental, or Non-standard.
Not always. true means the element may be visible according to the checks you run. Elements outside the viewport or covered by other content can still return true.
getBoundingClientRect() gives geometry (size/position). checkVisibility() answers whether the element is potentially visible under CSS box / visibility rules. Use both when you need size and visibility.
An optional object: opacityProperty (alias checkOpacity), visibilityProperty (alias checkVisibilityCSS), and contentVisibilityAuto. Each defaults to false.
Feature-detect with typeof el.checkVisibility === "function" and fall back to heuristics like getBoundingClientRect() size checks when needed.