Optional
About
The :optional
pseudo-class matches input elements that are optional.
Non-required Inputs
Inputs without the required
attribute are matched. This also includes checkboxes, radio buttons, select elements and textareas.
Required Inputs
Inputs with the required
attribute are not matched.
Buttons
The selector also matches buttons. Buttons don't support the required
attribute, so they are always matched.