How TO - Color Picker


Learn how to create a color picker in HTML.


Color picker

Pick a color:

You can use the input type="color" attribute to create a color picker:

Example

<label for="favcolor">Select your favorite color:</label>
<input type="color" id="favcolor" value="#ff0000">
Try it Yourself »

Note that you have to use hex values inside the value property. The default value is black (#000000) if nothing is used. You can learn more about HEX values in our HTML Colors Tutorial.


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.