pseudo-class
:modal — CSS reference
Matches a modal element, for example a dialog opened using showModal(). An open nonmodal dialog does not match merely because its open attribute is present.
Formal Syntax & Structure
css syntaxcss
:modalWorking Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>#a,#b {color:#202020} #a:modal {color:#006050}</style><body><dialog id="a"><form method="dialog"><button>Close</button></form></dialog><dialog id="b" open>Nonmodal</dialog><script>a.showModal();</script></body></html>