How to create html css under line button css hover effect neon.

 CSS underline Button

                 

Here we are creating a button. The specialties of this button is when we hover on it. 

It will linearly change the its color and show bar under the button too.

Like this:




watch video:





source code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Button</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap');

:root{
    --red:#ff0000;
    --green:#00ff55;
    --blue:#ff00d4;
}
.container{
    displayflex;
    flex-directioncolumn;
    width:100vw;
    height100vh;
    justify-contentcenter;
    align-itemscenter;
    background-colorblack;
}
.btn{
    colorwhite;
    width100px;
    font-family"Bebas Neue";
    letter-spacingnormal;
    font-size30px;
    text-aligncenter;
    cursorpointer;
    transitionall 1s;
}
.btn:hover{
    text-shadow0px 0px 5px var(--red);
}
.line{
    width:0px;
    height:4px;
    background-colorwhite;
transitionall 1s;
}
.btn:hover .line{
    width:100%;
    height4px;
    background-colorvar(--red);
    box-shadow0px 0px 6px var(--red);

}

.btn2{
    colorwhite;
    width100px;
    font-family"Bebas Neue";
    letter-spacingnormal;
    font-size30px;
    text-aligncenter;
    cursorpointer;
    transitionall 1s;
}
.btn2:hover{
    text-shadow0px 0px 5px var(--green);
}
.line2{
    width:0px;
    height:4px;
    background-colorwhite;
transitionall 1s;
}
.btn2:hover .line2{
    width:100%;
    height4px;
    background-colorvar(--green);
    box-shadow0px 0px 6px var(--green);
}

.btn3{
    colorwhite;
    width100px;
    font-family"Bebas Neue";
    letter-spacingnormal;
    font-size30px;
    text-aligncenter;
    cursorpointer;
    transitionall 1s;
}
.btn3:hover{
    text-shadow0px 0px 5px var(--blue);
}
.line3{
    width:0px;
    height:4px;
    background-colorwhite;
transitionall 1s;
}
.btn3:hover .line3{
    width:100%;
    height4px;
    background-colorvar(--blue);
    box-shadow0px 0px 6px var(--blue);
}

</style>

</head>
<body>
    <div class="container">
        <div class="btn">
            Hover me
            <div class="line"></div>
        </div>
        <br>
        <div class="btn2">
                hover me
            <div class="line2"></div>
        </div>
        <br>
        <div class="btn3">
            hover me
            <div class="line3"></div>
        </div>
    </div>
</body>
</html>

download source code

Post a Comment

0 Comments