:open

Targets elements that are currently in an 'open' state, such as a <details> element that is expanded or a <dialog> that is visible.

Quick example

details:open {
  /* Adds a top border to the content box only when the details are open */
  border-top: 2px solid #3b82f6;
}

:open Browser Support

Limited availability 71% global usage

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Not ready for production without a fallback.

133+
136+
133+
ESC