Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save djsubstance/49556da1827317a4b534709187705b8a to your computer and use it in GitHub Desktop.
Save djsubstance/49556da1827317a4b534709187705b8a to your computer and use it in GitHub Desktop.
day 30 today we going to design a button with an awesome hover effect.

day 30 today we going to design a button with an awesome hover effect.

A Pen by Ajay on CodePen.

License.

<body>
<button>
hover me
<span class="first"></span>
<span class="second"></span>
<span class="third"></span>
<span class="fourth"></span>
</button>
</body>
<title>day 30</title>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
background: #000;
}
button {
border: none;
padding: 20px 40px;
font-size: 44px;
position: relative;
background: transparent;
color: #ffa500;
text-transform: uppercase;
border: 3px solid #ffa500;
cursor: pointer;
transition: all 0.7s;
overflow: hidden;
border-radius: 100px;
}
button:hover {
color: #000;
}
span {
transition: all 0.7s;
z-index: -1;
}
button .first {
content: "";
position: absolute;
right: 100%;
top: 0;
width: 25%;
height: 100%;
background: #ffa500;
}
button:hover .first {
top: 0;
right: 0;
}
button .second {
content: "";
position: absolute;
left: 25%;
top: -100%;
height: 100%;
width: 25%;
background: #ffa500;
}
button:hover .second {
top: 0;
left: 50%;
}
button .third {
content: "";
position: absolute;
left: 50%;
height: 100%;
top: 100%;
width: 25%;
background: #ffa500;
}
button:hover .third {
top: 0;
left: 25%;
}
button .fourth {
content: "";
position: absolute;
left: 100%;
top: 0;
height: 100%;
width: 25%;
background: #ffa500;
}
button:hover .fourth {
top: 0;
left: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment