Open In App

How CSS transition work with linear gradient background button?

In CSS, you can smoothly make transitions between two or more colors. CSS has two types of gradients:

Syntax:

background-image: radial-gradient(shape size at position, 
start-color, ...);

Example:




<!DOCTYPE html>
<html>
    <head>
        <title>
            Transition work with linear gradient
            background button
        </title>
        <style>
            button {
                background-image: 
                linear-gradient(to bottom right, green, white);
            }
            button:hover {
                background-image: 
                linear-gradient(to bottom right, green, yellow);
            }
              
            h1 {
                color: green;
            }
        </style>
    </head>
    <body>
        <center>
            <h1>GeeksforGeeks</h1>
            <b>Hover over the bytton</b>
            <br>
            <br>
            <button>Click me</button>
        </center>
    </body>
</html>

Output:


Article Tags :