top of page

Button with gradient background

Writer: Web Coding
Web Coding
Sep 4, 2020
1 min read

Updated: Sep 6, 2020

Learn how to create a button with a gradient background using only HTML and CSS

HTML Code

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Buttont</title>
 <link rel="stylesheet" href="style.css">
 <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap" rel="stylesheet">
</head>
<body>
 <button id="Btn">Click Me</button>
</body>
</html>

CSS Code

body{
 display: flex;
 align-items: center;
 justify-content: center;
 min-height: 100vh;
 background-color: #1f1f1f;
}

#Btn{
 font-family: 'Source Sans Pro', sans-serif;
 background: linear-gradient(to right, #ff0099, #493240);
 font-size: 24px;
 padding: 12px 30px;
 border: none;
 outline: none;
 border-radius: 38px;
}

#Btn:hover{
 filter: brightness(75%);
 cursor: pointer;
}

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


  • YouTube
  • Instagram

©2020 by Web Coding. Proudly created with Wix.com

bottom of page