Gradient Hover Transition on Buttons

Developer
Size
4,209 Kb
Views
4,048

How do I make an gradient hover transition on buttons?

Transition background color on a button using gradients. What is a gradient hover transition on buttons? How do you make a gradient hover transition on buttons? This script and codes were developed by EY-Intuitive on 17 January 2023, Tuesday.

Gradient Hover Transition on Buttons Previews

Gradient Hover Transition on Buttons - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Gradient Hover Transition on Buttons</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body { background-color: #333;
}
h1 { text-align: center; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; font-size: 30px; line-height: 34px; color: white; margin-bottom: 30px;
}
section { padding: 40px; background-color: #333;
}
section.alt { background-color: #555;
}
button { cursor: pointer;
}
.flatButton { margin: 10px auto;
}
.flatButton.green { transition: background 0.2s ease; display: block; background: #2ecc71; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.flatButton.green:hover { background: #188546;
}
.flatButton.blue { transition: background 0.2s ease; display: block; background: #3498db; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.flatButton.blue:hover { background: #2371a4;
}
.flatButton.orange { transition: background 0.2s ease; display: block; background: #e67e22; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.flatButton.orange:hover { background: #d35400;
}
.gradientButton { margin: 10px auto;
}
.gradientButton.green { display: block; position: relative; background: #2ecc71; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.gradientButton.green:after { transition: opacity 0.2s ease; content: attr(data-title); border-radius: 3px; position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#2ecc71, #188546); z-index: 1; opacity: 0;
}
.gradientButton.green:hover:after { opacity: 1;
}
.no-cssgradients .gradientButton.green:after { background: #188546;
}
.gradientButton.blue { display: block; position: relative; background: #3498db; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.gradientButton.blue:after { transition: opacity 0.2s ease; content: attr(data-title); border-radius: 3px; position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#3498db, #2371a4); z-index: 1; opacity: 0;
}
.gradientButton.blue:hover:after { opacity: 1;
}
.no-cssgradients .gradientButton.blue:after { background: #2371a4;
}
.gradientButton.orange { display: block; position: relative; background: #e67e22; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.gradientButton.orange:after { transition: opacity 0.2s ease; content: attr(data-title); border-radius: 3px; position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#e67e22, #d35400); z-index: 1; opacity: 0;
}
.gradientButton.orange:hover:after { opacity: 1;
}
.no-cssgradients .gradientButton.orange:after { background: #d35400;
}
.gradientToGradientButton { margin: 10px auto;
}
.gradientToGradientButton.green { display: block; position: relative; background: linear-gradient(#2ecc71, #188546); border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; overflow: hidden;
}
.no-cssgradients .gradientToGradientButton.green { background: #2ecc71;
}
.gradientToGradientButton.green:after { transition: opacity 0.2s ease; border-radius: 3px; content: attr(data-title); position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#188546, #2ecc71); z-index: 1; opacity: 0;
}
.gradientToGradientButton.green:hover:after { opacity: 1;
}
.no-cssgradients .gradientToGradientButton.green:after { background: #188546;
}
.gradientToGradientButton.blue { display: block; position: relative; background: linear-gradient(#3498db, #2371a4); border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; overflow: hidden;
}
.no-cssgradients .gradientToGradientButton.blue { background: #3498db;
}
.gradientToGradientButton.blue:after { transition: opacity 0.2s ease; border-radius: 3px; content: attr(data-title); position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#2371a4, #3498db); z-index: 1; opacity: 0;
}
.gradientToGradientButton.blue:hover:after { opacity: 1;
}
.no-cssgradients .gradientToGradientButton.blue:after { background: #2371a4;
}
.gradientToGradientButton.orange { display: block; position: relative; background: linear-gradient(#e67e22, #d35400); border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; overflow: hidden;
}
.no-cssgradients .gradientToGradientButton.orange { background: #e67e22;
}
.gradientToGradientButton.orange:after { transition: opacity 0.2s ease; border-radius: 3px; content: attr(data-title); position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#d35400, #e67e22); z-index: 1; opacity: 0;
}
.gradientToGradientButton.orange:hover:after { opacity: 1;
}
.no-cssgradients .gradientToGradientButton.orange:after { background: #d35400;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <section> <h1>Flat Buttons</h1> <button class="flatButton green"> Button </button> <button class="flatButton blue"> Button </button> <button class="flatButton orange"> Button </button>
</section>
<section class="alt"> <h1>Flat to Gradient Buttons</h1> <button class="gradientButton green" data-title="Button"> Button </button> <button class="gradientButton blue" data-title="Button"> Button </button> <button class="gradientButton orange" data-title="Button"> Button </button>
</section>
<section> <h1>Gradient to Gradient Buttons</h1> <button class="gradientToGradientButton green" data-title="Button"> Button </button> <button class="gradientToGradientButton blue" data-title="Button"> Button </button> <button class="gradientToGradientButton orange" data-title="Button"> Button </button>
</section> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
</body>
</html>

Gradient Hover Transition on Buttons - Script Codes CSS Codes

body { background-color: #333;
}
h1 { text-align: center; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; font-size: 30px; line-height: 34px; color: white; margin-bottom: 30px;
}
section { padding: 40px; background-color: #333;
}
section.alt { background-color: #555;
}
button { cursor: pointer;
}
.flatButton { margin: 10px auto;
}
.flatButton.green { transition: background 0.2s ease; display: block; background: #2ecc71; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.flatButton.green:hover { background: #188546;
}
.flatButton.blue { transition: background 0.2s ease; display: block; background: #3498db; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.flatButton.blue:hover { background: #2371a4;
}
.flatButton.orange { transition: background 0.2s ease; display: block; background: #e67e22; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.flatButton.orange:hover { background: #d35400;
}
.gradientButton { margin: 10px auto;
}
.gradientButton.green { display: block; position: relative; background: #2ecc71; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.gradientButton.green:after { transition: opacity 0.2s ease; content: attr(data-title); border-radius: 3px; position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#2ecc71, #188546); z-index: 1; opacity: 0;
}
.gradientButton.green:hover:after { opacity: 1;
}
.no-cssgradients .gradientButton.green:after { background: #188546;
}
.gradientButton.blue { display: block; position: relative; background: #3498db; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.gradientButton.blue:after { transition: opacity 0.2s ease; content: attr(data-title); border-radius: 3px; position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#3498db, #2371a4); z-index: 1; opacity: 0;
}
.gradientButton.blue:hover:after { opacity: 1;
}
.no-cssgradients .gradientButton.blue:after { background: #2371a4;
}
.gradientButton.orange { display: block; position: relative; background: #e67e22; border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
}
.gradientButton.orange:after { transition: opacity 0.2s ease; content: attr(data-title); border-radius: 3px; position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#e67e22, #d35400); z-index: 1; opacity: 0;
}
.gradientButton.orange:hover:after { opacity: 1;
}
.no-cssgradients .gradientButton.orange:after { background: #d35400;
}
.gradientToGradientButton { margin: 10px auto;
}
.gradientToGradientButton.green { display: block; position: relative; background: linear-gradient(#2ecc71, #188546); border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; overflow: hidden;
}
.no-cssgradients .gradientToGradientButton.green { background: #2ecc71;
}
.gradientToGradientButton.green:after { transition: opacity 0.2s ease; border-radius: 3px; content: attr(data-title); position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#188546, #2ecc71); z-index: 1; opacity: 0;
}
.gradientToGradientButton.green:hover:after { opacity: 1;
}
.no-cssgradients .gradientToGradientButton.green:after { background: #188546;
}
.gradientToGradientButton.blue { display: block; position: relative; background: linear-gradient(#3498db, #2371a4); border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; overflow: hidden;
}
.no-cssgradients .gradientToGradientButton.blue { background: #3498db;
}
.gradientToGradientButton.blue:after { transition: opacity 0.2s ease; border-radius: 3px; content: attr(data-title); position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#2371a4, #3498db); z-index: 1; opacity: 0;
}
.gradientToGradientButton.blue:hover:after { opacity: 1;
}
.no-cssgradients .gradientToGradientButton.blue:after { background: #2371a4;
}
.gradientToGradientButton.orange { display: block; position: relative; background: linear-gradient(#e67e22, #d35400); border: none; outline: none; border-radius: 3px; color: white; font-size: 18px; padding: 20px 30px; font: 300 18px/20px "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; overflow: hidden;
}
.no-cssgradients .gradientToGradientButton.orange { background: #e67e22;
}
.gradientToGradientButton.orange:after { transition: opacity 0.2s ease; border-radius: 3px; content: attr(data-title); position: absolute; top: 0; left: 0; right: 0; bottom: 0; padding: 20px 30px; background: linear-gradient(#d35400, #e67e22); z-index: 1; opacity: 0;
}
.gradientToGradientButton.orange:hover:after { opacity: 1;
}
.no-cssgradients .gradientToGradientButton.orange:after { background: #d35400;
}
Gradient Hover Transition on Buttons - Script Codes
Gradient Hover Transition on Buttons - Script Codes
Home Page Home
Developer EY-Intuitive
Username ey_intuitive
Uploaded January 17, 2023
Rating 3
Size 4,209 Kb
Views 4,048
Do you need developer help for Gradient Hover Transition on Buttons?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

EY-Intuitive (ey_intuitive) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!