Monday, 8 August 2016

CREATE AN ANIMATED HTML BUTTON USING CSS

below is a simple html and css code for this animated button
<!DOCTYPE html>
<html>
<head>
<style>
.button {
    position: relative;
    background-color:black;
    border: none;
    font-size: 30px;
    color:white;
    padding: 25px;
    width: 250px;
    text-align: center;
    -webkit-transition-duration: 2.2s; /* Safari */
    transition-duration: 2.2s;
    text-decoration: none;
    overflow: hidden;
    cursor: pointer;
}

.button:after {
    content: "";
    background: white;
    display: block;
    position: absolute;
    padding-top: 300%;
    padding-left: 350%;
    margin-left: -20px!important;
    margin-top: -120%;
    opacity: 0.2;
    transition: all 2.2s



}

.button:active:after {
    padding: 0;
    margin: 0;
    opacity: 1;
    transition: 0s
}
</style>
</head>
<body>

<h2>your animated button</h2>

<button class="button">click</button>

</body>
</html>
here is what you should have if your code is correct.

your animated button

Share:

0 comments:

Post a Comment