Table of Contents

How to add a color in a HTML input form?

About

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

Example

No value

The default value is black.

<input type="color"  name="color"  />

Specific color

Example:

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

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.