CSS :required Selector
Use the :optional selector to select form elements which are optional.
This pseudo-class is useful for highlighting fields that must have valid data before a form can be submitted.
Note: The :optional pseudo-class selects optional form fields.
Mandatory <input> should have the required attribute applied to them.
This will ensure that people navigating with the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful submission.
The numbers in the table specify the first browser version that fully supports the property.