Fri Apr 15 2022
Button Sliding Effect
CSS6045 views
File Name: button-background-sliding-on-hover.html
<!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>Css3 Button Hover Effect with Before Element</title>
<style>
body {
background-color: #383838;
}
a.btn {
display: inline-block;
padding: 8px 30px;
text-decoration: none;
border: #fff solid 3px;
color: #fff;
border-radius: 20px;
font-size: 18px;
position: relative;
overflow: hidden;
transition: 0.35s all ease-in-out;
}
a.btn:hover {
border-color: #ff6600;
}
a.btn::before {
position: absolute;
content: '';
width: 100%;
height: 100%;
left: -100%;
top: 0;
background-color: #ff6600;
z-index: -1;
transition: 0.35s all ease-in-out;
}
a.btn:hover::before {
left: 0;
}
a.btn.rightBtn::before {
left: auto;
right: -100%;
}
a.btn.rightBtn:hover::before {
right: 0;
}
</style>
</head>
<body>
<a href="" class="btn">Button</a>
<a href="" class="btn rightBtn">Button</a>
</body>
</html>
Author:Geekboots