top of page
Writer's pictureWeb Coding

Button with gradient background

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{
 displayflex;
 align-itemscenter;
 justify-contentcenter;
 min-height100vh;
 background-color#1f1f1f;
}

#Btn{
 font-family'Source Sans Pro'sans-serif;
 backgroundlinear-gradient(to right#ff0099#493240);
 font-size24px;
 padding12px 30px;
 bordernone;
 outlinenone;
 border-radius38px;
}

#Btn:hover{
 filterbrightness(75%);
 cursorpointer;
}

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

17 views

Comments


bottom of page