:open

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

/* Usage Example */
details:open {
  /* Adds a top border to the content box only when the details are open */
  border-top: 2px solid #3b82f6;
}
Limited availability Since 2020 71% global usage

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

133+
136+
133+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC