HTML <input type="color">
Example
Show a color picker (with a predefined red value):
<label for="favcolor">Select your favorite color:</label>
<input type="color"
id="favcolor" name="favcolor"
value="#ff0000">
Try it Yourself »
Definition and Usage
The <input type="color">
defines a color picker.
The default value is #000000 (black). The value must be in seven-character hexadecimal notation.
Tip: Always add the <label>
tag
for best accessibility practices!
Browser Support
The numbers in the table specify the first browser version that fully supports the element.
Attribute | |||||
---|---|---|---|---|---|
type="color" | 20.0 | 38.0 | 29.0 | 10.1 | 11.01 |
Syntax
<input type="color">