Using the input Element to Obtain a Color

Description

The color type of input element restricts the user to selecting a color.

Color values are expressed as exactly seven characters: a leading #, followed by three two-digit hexadecimal values representing the red, green, and blue values (for example, #FF1234).

Example

You can see this type of input element in use in the following code.


<!DOCTYPE HTML>
<html>
<body>
  <form method="post" action="http://example.com/form">
    <p>
      <label for="color"> Color:
      <input type="color" id="color" name="color" />
      </label>
    </p><!--from  ww  w.j  a v a2  s .  co m-->
    <input type="submit" value="Submit Vote" />
  </form>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed