CSS :modal pseudo-class

Definition and usage

CSS :modal Pseudo-classes are used to select and set the style of elements in modal state.

Example

Select and set the style of elements in modal state:

:modal {
  background-color: gold;
  border: 2px solid maroon;
  border-radius: 8px;
  font-size: 20px;
}

Try it yourself

CSS syntax

:modal {
  css declarations;
}

Technical details

Version: CSS4

Browser support

Table numbers specify the first browser version that fully supports this pseudo-class.

Chrome Edge Firefox Safari Opera
105 105 103 15.6 91