Computer >> Computer tutorials >  >> Programming >> HTML

How to use input type field with the color picker in HTML?


The <input type="color"> is for input fields with color. It will allow you to select a color from color picker.

A color picker will be visible when you will click on the default color box. Here, you can set the default color also with the value attribute −

How to use input type field with the color picker in HTML?

Example

You can try to run the following code to show a color picker with input type color −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML input color</title>
   </head>
   <body>
      <form action = "" method = "get">
         Select which color you want for your website:<br><br>
         <input type="color" name="favcolor" value="#FFFFF"><br>
         <input type="submit" value="submit">
      </form>
   </body>
</html>