This post contains a total of 7+ Hand-Picked CSS Close Button Examples with Source Code. All the Close Buttons are made using CSS.
You can use the source code of these examples for educational purpose with credits to the original owner.
Related Posts
Click a Code to Copy it.
1. By Marius Nicula
Made by Marius Nicula. A simple but interactive close button. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<style>
div a {
width: 100px;
height: 100px;
position: absolute;
right: 50%;
top: 50%;
margin-top: -50px;
margin-right: -50px;
background-color: #ffffff;
border-radius: 50px;
opacity: 1;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
-webkit-box-shadow: 0px 0px 30px 0px rgba(247, 149, 29, 0.5);
-moz-box-shadow: 0px 0px 30px 0px rgba(247, 149, 29, 0.5);
box-shadow: 0px 0px 30px 0px rgba(247, 149, 29, 0.5);
}
div a > span {
background-color: #f5a700;
display: block;
height: 12px;
border-radius: 6px;
position: relative;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
position: absolute;
top: 50%;
margin-top: -6px;
left: 18px;
width: 64px;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-justify-content: space-between;
justify-content: space-between;
-moz-justify-content: space-between;
-ms-justify-content: space-between;
}
div a > span span {
display: block;
background-color: #ed7f00;
width: 12px;
height: 12px;
border-radius: 6px;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
position: absolute;
left: 0;
top: 0;
}
div a > span.left {
transform: rotate(45deg);
transform-origin: center;
}
div a > span.left .circle-left {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 0;
}
div a > span.left .circle-right {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 52px;
}
div a > span.right {
transform: rotate(-45deg);
transform-origin: center;
}
div a > span.right .circle-left {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 0;
}
div a > span.right .circle-right {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 52px;
}
div a:hover > span {
background-color: #2faee0;
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
}
div a:hover > span span {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
background-color: #008ac9;
}
div a:hover > span.left .circle-left {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 52px;
}
div a:hover > span.left .circle-right {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 0;
}
div a:hover > span.right .circle-left {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 52px;
}
div a:hover > span.right .circle-right {
transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
margin-left: 0;
}
</style>
</head>
<body>
<div>
<a href="#">
<span class="left">
<span class="circle-left"></span>
<span class="circle-right"></span>
</span>
<span class="right">
<span class="circle-left"></span>
<span class="circle-right"></span>
</span>
</a>
</div>
</body>
</html>
2. By Rémi Lacorne
Made by Rémi Lacorne. Simple CSS Close button with animation. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>n</title>
<style>
body, html {
min-height: 100%;
min-width: 100%;
height: 100%;
width: 100%;
padding: 0;
margin: 0;
background-color: DarkSeaGreen;
}
.container {
position: relative;
width: 100%;
height: 100%;
padding: 100px 0 0 0;
}
.circle {
width: 50px;
height: 50px;
background-color: floralwhite;
border-radius: 25px;
margin: auto;
box-shadow: 1px 1px 1px #565656;
position: relative;
transition: all 0.2s;
}
.circle:hover {
background-color: #6fa96f;
cursor: pointer;
}
.circle:hover > .one {
height: 45px;
top: 3px;
transition: all 0.5s;
background-color: floralwhite;
}
.circle:hover > .two {
height: 45px;
top: 3px;
transition: all 0.5s;
background-color: floralwhite;
}
.line {
height: 20px;
width: 3px;
border-radius: 2px;
background-color: #568f56;
position: absolute;
transition: all 0.5s;
}
.one {
top: 15px;
left: 23px;
transform: rotate(45deg);
}
.two {
top: 15px;
left: 23px;
transform: rotate(-45deg);
}
</style>
</head>
<body>
<div class="container">
<div class="circle">
<div class="line one"></div>
<div class="line two"></div>
</div>
</div>
</body>
</html>
3. By Marvin van Kalsbeek
Made by Marvin van Kalsbeek. Simple pure css close button. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<style>
.close-button {
height: 50px;
width: 50px;
position: relative;
box-sizing: border-box;
line-height: 50px;
display: inline-block;
}
.close-button:before,
.close-button:after {
transform: rotate(-45deg);
content: '';
position: absolute;
top: 50%;
left: 50%;
margin-top: -5px;
margin-left: -25px;
display: block;
height: 10px;
width: 50px;
background-color: #fff;
transition: all 0.2s ease-out;
}
.close-button:after {
transform: rotate(45deg);
}
.close-button:hover:before,
.close-button:hover:after {
transform: rotate(0deg);
}
body {
color: #fff;
font-family: arial, sans-sarif;
background-color: #333;
text-align: center;
}
</style>
</head>
<body>
<h2>My close button</h2>
<a href="#" class="close-button"></a>
</body>
</html>
4. By Zach Wolf
Made by Zach Wolf. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<style>
body {
background: #666;
margin: 0;
padding: 0;
}
.centererer {
position: absolute;
height: 26px;
width: 26px;
top: 50%;
margin-top: -20px;
left: 50%;
margin-left: -20px;
}
.close {
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwLjUiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMC4wIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'), url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2YyZjJmMiIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2NjY2NjYyIvPjwvcmFkaWFsR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, rgba(255, 255, 255, 0.5)), color-stop(100%, rgba(255, 255, 255, 0))), radial-gradient(#f2f2f2, #cccccc);
background: -moz-linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), -moz-radial-gradient(#f2f2f2, #cccccc);
background: -webkit-linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), -webkit-radial-gradient(#f2f2f2, #cccccc);
background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), radial-gradient(#f2f2f2, #cccccc);
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
-moz-box-shadow: inset 0 1px 1px rgba(191, 191, 191, 0.75), 0 2px 1px rgba(0, 0, 0, 0.25);
-webkit-box-shadow: inset 0 1px 1px rgba(191, 191, 191, 0.75), 0 2px 1px rgba(0, 0, 0, 0.25);
box-shadow: inset 0 1px 1px rgba(191, 191, 191, 0.75), 0 2px 1px rgba(0, 0, 0, 0.25);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
border: 2px solid #e6e6e6;
color: #b3b3b3;
float: right;
height: 23px;
width: 23px;
text-indent: -9999px;
position: absolute;
text-decoration: none;
}
.close::after {
content: "\2716";
text-indent: 0;
display: block;
position: absolute;
top: 2px;
right: 5px;
font-size: 12px;
}
.close:hover {
color: #e6e6e6;
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwLjUiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMC4wIi8+PC9saW5lYXJHcmFkaWVudD48L2RlZnM+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNncmFkKSIgLz48L3N2Zz4g'), url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2IzYjNiMyIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzhjOGM4YyIvPjwvcmFkaWFsR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, rgba(255, 255, 255, 0.5)), color-stop(100%, rgba(255, 255, 255, 0))), radial-gradient(#b3b3b3, #8c8c8c);
background: -moz-linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), -moz-radial-gradient(#b3b3b3, #8c8c8c);
background: -webkit-linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), -webkit-radial-gradient(#b3b3b3, #8c8c8c);
background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)), radial-gradient(#b3b3b3, #8c8c8c);
text-shadow: 0 -1px 0 rgba(153, 153, 153, 0.5);
cursor: pointer;
}
.close:active {
background: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwLjE1Ii8+PHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZmZmZmZmIiBzdG9wLW9wYWNpdHk9IjAuMCIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='), url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHJhZGlhbEdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iMTAwJSI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzhjOGM4YyIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzgwODA4MCIvPjwvcmFkaWFsR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA==');
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, rgba(255, 255, 255, 0.15)), color-stop(100%, rgba(255, 255, 255, 0))), radial-gradient(#8c8c8c, #808080);
background: -moz-linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0)), -moz-radial-gradient(#8c8c8c, #808080);
background: -webkit-linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0)), -webkit-radial-gradient(#8c8c8c, #808080);
background: linear-gradient(rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0)), radial-gradient(#8c8c8c, #808080);
text-shadow: 0 -1px 0 rgba(26, 26, 26, 0.5);
cursor: pointer;
}
</style>
</head>
<body>
<div class="centererer">
<button class="close">Close</button>
</div>
</body>
</html>
5. By merrybottle
Made by merrybottle. CSS Close button with cool animation. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<style>
@import url('https://fonts.googleapis.com/css?family=Josefin+Sans&display=swap');
html, body {
margin: 0;
min-height: 100vh;
padding: 0;
}
body {
background: #8A2387;
background: linear-gradient(to right, #F27121, #E94057, #8A2387);
position: relative;
text-align: center;
}
button {
background: none;
border: 0;
box-sizing: border-box;
color: transparent;
cursor: pointer;
font-family: 'Josefin Sans', sans-serif;
font-size: 18px;
left: 50%;
letter-spacing: 1.5px;
line-height: 90px;
outline: none;
overflow: hidden;
padding: 10px 0 0;
position: absolute;
text-transform: uppercase;
top: 50%;
transform: translate(-50%, -50%);
transition: all 0.2s ease-in;
width: 100px;
}
button::before,
button::after {
background-color: white;
content: '';
display: block;
height: 3px;
left: 0;
position: absolute;
transform-origin: center left;
transition: all 0.2s ease-in;
width: 141.4214px;
z-index: -1;
}
button::before {
top: 0;
transform: rotate(45deg);
}
button::after {
bottom: 0;
transform: rotate(-45deg);
}
button:hover {
color: #8A2387;
}
button:hover::before,
button:hover::after {
height: 50px;
transform: rotate(0deg);
}
</style>
</head>
<body>
<button>
Close
</button>
</body>
</html>
6. By Jermbo
Made by Jermbo. Close button with rotating animation. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<style>
.close-button {
width: 150px;
height: 150px;
box-shadow: 0px 10 10px 10px rgba(0, 0, 0, 0.25);
border-radius: 10px;
background: #000;
left: 50%;
top: 50%;
margin-top: -75px;
margin-left: -75px;
position: absolute;
display: block;
z-index: 200;
text-indent: -9999px;
}
.close-button:before,
.close-button:after {
content: '';
width: 55%;
height: 2px;
background: #fff;
position: absolute;
top: 48%;
left: 22%;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.close-button:after {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.close-button:hover:before,
.close-button:hover:after {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
body {
background: #a7cfdf;
background: -moz-linear-gradient(45deg, #a7cfdf 0%, #23538a 100%);
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #a7cfdf), color-stop(100%, #23538a));
background: -webkit-linear-gradient(45deg, #a7cfdf 0%, #23538a 100%);
background: -o-linear-gradient(45deg, #a7cfdf 0%, #23538a 100%);
background: -ms-linear-gradient(45deg, #a7cfdf 0%, #23538a 100%);
background: linear-gradient(45deg, #a7cfdf 0%, #23538a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a7cfdf', endColorstr='#23538a', GradientType=1);
}
</style>
</head>
<body>
<a class="close-button" href="/">Close</a>
</body>
</html>
7. By Maneesh
Made by Maneesh. Close button with simple close animation. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<style>
body {
background: #121212;
}
.wrapper {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.close-button {
display: block;
width: 40px;
height: 40px;
position: relative;
overflow: hidden;
}
.close-button > div {
position: relative;
}
.close-button-block {
width: 40px;
height: 20px;
position: relative;
overflow: hidden;
}
.close-button-block:before, .close-button-block:after {
content: "";
position: absolute;
bottom: 0;
left: calc(55% - 4px);
display: block;
width: 4px;
height: 25px;
transform-origin: bottom center;
background: white;
transition: all ease-out 280ms;
}
.close-button-block:last-of-type {
transform: rotate(180deg);
}
.close-button .in .close-button-block:before {
transition-delay: 280ms;
transform: translateX(20px) translateY(-20px) rotate(45deg);
}
.close-button .in .close-button-block:after {
transition-delay: 280ms;
transform: translateX(-22px) translateY(-22px) rotate(-45deg);
}
.close-button .out {
position: absolute;
top: 0;
left: 0;
}
.close-button .out .close-button-block:before {
transform: translateX(-5px) translateY(5px) rotate(45deg);
}
.close-button .out .close-button-block:after {
transform: translateX(5px) translateY(5px) rotate(-45deg);
}
.close-button:hover .in .close-button-block:before {
transform: translateX(-5px) translateY(5px) rotate(45deg);
}
.close-button:hover .in .close-button-block:after {
transform: translateX(5px) translateY(5px) rotate(-45deg);
}
.close-button:hover .out .close-button-block:before {
transform: translateX(-20px) translateY(20px) rotate(45deg);
}
.close-button:hover .out .close-button-block:after {
transform: translateX(20px) translateY(20px) rotate(-45deg);
}
</style>
</head>
<body>
<div class="wrapper">
<a href="#" class="close-button">
<div class="in">
<div class="close-button-block"></div>
<div class="close-button-block"></div>
</div>
<div class="out">
<div class="close-button-block"></div>
<div class="close-button-block"></div>
</div>
</a>
</div>
</body>
</html>
8. By Paraskevas Dinakis
Made by Paraskevas Dinakis. ( Source )
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title></title>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background: #141926;
font-family: Helvetica, Arial, sans-serif;
}
.outer {
position: relative;
margin: auto;
width: 70px;
margin-top: 200px;
cursor: pointer;
}
.inner {
width: inherit;
text-align: center;
}
label {
font-size: .8em;
line-height: 4em;
text-transform: uppercase;
color: #fff;
transition: all .3s ease-in;
opacity: 0;
cursor: pointer;
}
.inner:before, .inner:after {
position: absolute;
content: '';
height: 1px;
width: inherit;
background: #FFC107;
left: 0;
transition: all .3s ease-in;
}
.inner:before {
top: 50%;
transform: rotate(45deg);
}
.inner:after {
bottom: 50%;
transform: rotate(-45deg);
}
.outer:hover label {
opacity: 1;
}
.outer:hover .inner:before,
.outer:hover .inner:after {
transform: rotate(0);
}
.outer:hover .inner:before {
top: 0;
}
.outer:hover .inner:after {
bottom: 0;
}
</style>
</head>
<body>
<div class="outer">
<div class="inner">
<label>Back</label>
</div>
</div>
</body>
</html>