pseudo-class

:open — CSS reference

Matches elements with an open state, such as an expanded details or open dialog. It does not mean every visible element; popovers have their own state selector.

Formal Syntax & Structure

css syntaxcss
:open

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>#a,#b {color:#202020} #a:open {color:#006050}</style><body><details id="a" open><summary>Open</summary>Content</details><details id="b"><summary>Closed</summary>Other</details></body></html>
CSS Reference