How to add a color in a HTML input form?


This article shows you how to add a color value with an input control 1) in a form.


No value

The default value is black.

<input type="color"  name="color"  />
  • Output:

Specific color


<input type="color"  name="color" value="#00FFFF" />
  • Output:

Browser native Validation

A color input's value is valid if the browser (user agent) can convert the user's input into seven-character lower-case hexadecimal notation.

Discover More
Color in HTML

How colors are defined in HTML
What are HTML Input Elements?

An inputinput element of a form control that permits to define a scalar value (single value) inputFull list Ref Doc The type attribute defined: the default behavior the design of the element....

Share this page:
Follow us:
Task Runner