Easy Tutorial
❮ Sel Attr Contain Pr List Style ❯

CSS :required Selector

Complete CSS Selector Reference

Example

Set the input element to yellow if it has the "required" attribute:


Definition and Usage

The :required selector is used to style form elements that are required.

Form elements can be set as required using the required attribute.

Note: The :required selector only applies to form elements: input, select, and textarea.


Browser Support

The numbers in the table specify the first browser version that fully supports the attribute.

Selector
:required 10.0 10.0 4.0 5.0 10.0

CSS Syntax


Related Pages

CSS Selector :optional


Complete CSS Selector Reference

❮ Sel Attr Contain Pr List Style ❯