Horje

How to add HTML <input type="color">

Show a color picker (with a predefined red value).

color Defines a color picker

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.

Syntax

<input type="color">

index.html
Example: HTML
<label for="favcolor">Select your favorite color:</label>
<input type="color" id="favcolor" name="favcolor" value="#ff0000">

Output should be:

How to add HTML <input type="color">




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin