Hello Guys! Welcome to Coding Torque. In this blog, I’m going to explain to you how to make a Color picker using HTML and CSS. This will be a step-by-step guide. Let’s get started 🚀.
Before we start, here are some JavaScript Games you might like to create:
1. Snake Game using JavaScript
2. 2D Bouncing Ball Game using JavaScript
3. Rock Paper Scissor Game using JavaScript
4. Tic Tac Toe Game using JavaScript
5. Whack a Mole Game using JavaScript
I would recommend you don’t just copy and paste the code, just look at the code and type by understanding it.
HTML CodeÂ
Starter Template
<!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Google Fonts --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet"> <title>Custom Color picker using JavaScript - @code.scientist x @codingtorque</title> </head> <body> <div class="container"> <div style="text-align: center;"> <h1>Coding Torque</h1> <div> style="display: flex; justify-content:center"> <input type="text" id="hex"> <input type="color" id="color"> </div> </div> </div> </body> </html>
Output Till Now
CSS CodeÂ
Create a file style.css
and paste the code below.
body { background: linear-gradient(90deg, #8A2387, #E94057, #F27121); display: flex; justify-content: center; align-items: center; height: 100vh; font-family: poppins; } .container { background: rgba(255, 255, 255, 0.2); border-radius: 16px; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); backdrop-filter: blur(5px); border: 1px solid rgba(255, 255, 255, 0.3); width: 20rem; height: 10rem; padding: 32px; } input[type="color"] { background-color: white; border: none; border-radius: 5px; height: 40px; width: 40px; transition: 0.3s; } input[type="color"]:hover { background-color: deepskyblue; } input[type="text"] { border: none; padding: 10px; border-radius: 5px; outline: none; margin-right: 10px; }
Output Till Now
Written by: Piyush Patil
If you have any doubts or any project ideas feel free to Contact Us
Hope you find this post helpful💖