AlexElin
AlexElin

Reputation: 1570

Does CSS content-visibility: hidden modify a DOM?

There's a new CSS property content-visibility.
Does it modify a DOM when set to hidden value?

Upvotes: 0

Views: 129

Answers (1)

David Harvey
David Harvey

Reputation: 704

It does not modify the DOM.

Some great use cases for content-visibility: hidden are when implementing advanced virtual scrollers, and measuring layout. They're also great for single-page applications (SPA's). Inactive app views can be left in the DOM with content-visibility: hidden applied to prevent their display but maintain their cached state. This makes the view quick to render when it becomes active again.

Reference: https://web.dev/content-visibility/

Upvotes: 1

Related Questions