How to add a gradient border to a text input
- Web Coding

 - Sep 6, 2020
 - 1 min read
 
Learn how to add a gradient border to a text input using only HTML and CSS
HTML
<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Document</title>
 <link rel="stylesheet" href="style.css">
</head>
<body>
 <div id="grad">
 <input type="text" placeholder="First Name">
 </div>
</body>
</html>CSS
body{
 min-height: 100vh;
 display: flex;
 align-items: center;
 justify-content: center;
 background-color: #1f1f1f;
}
#grad{
 background: linear-gradient(to right, #11998e, #38ef7d);
 height: 10vh;
 border-radius: 32px;
 display: flex;
 justify-content: center;
 align-items: center;
}
input{
 padding-left: 7%;
 height: 85%;
 width: 90%;
 font-size: 28px;
 border-radius: 32px;
 outline: none;
 border: none;
}If you found this blog post helpful don’t forget to check out my other projects and if you want more content follow me on
YouTube: https://www.youtube.com/channel/UC2nxqB2usQIS2c8zwVZKWEQ
Instagram: https://www.instagram.com/coding_for_the_web/
Twitter: https://twitter.com/LearnWebCoding



Comments