<div class="container">
<a class="btn btn1" href="#"><span>hover me!</span></a>
</div>
@import url('https://fonts.googleapis.com/css?family=Roboto+Condensed:700');
* {
box-sizing: border-box;
margin:0;
padding:0;
}
html,body {
width:100%;
height:100%;
font-family: 'Roboto Condensed', sans-serif;
letter-spacing : 2px;
background-color:#000;
}
a {
margin-bottom: 30px;
}
p {
font-size: 13px;
font-weight: bold;
margin-bottom: 7px;
color: #444;
}
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
min-height: 100%;
margin: 0 auto;
padding: 50px;
}
/* button style from here */
// button Common
.btn {
position: relative;
display: inline-block;
width: 150px;
line-height: 3;
text-align: center;
text-decoration: none;
color: #21ebff;
font-size: 0.95rem;
font-weight: bold;
background: #000;
transition: all 0.3s;
cursor: pointer;
user-select: none;
}
.btn:hover {
color: #fff;
letter-spacing: 2px;
box-shadow: none;
transform: translateY(5px);
box-shadow: 0 0 5px #21ebff, inset 0 0 10px #0bf4f3, 0 0 20px #21ebff inset, 0 0 20px #21ebff inset;
}
/* btn1 */
// button line neutral
// common
$lineWidth : 2px;
%btnLine1 {
content: '';
position: absolute;
transition: all 0.1s;
background-color: #21ebff;
}
//each
.btn1::before {
@extend %btnLine1;
height: $lineWidth;
width: 0;
top: 0;
left: 0;
transition-delay: 0.4s;
}
.btn1::after {
@extend %btnLine1;
width: $lineWidth;
height: 0;
top: 0;
right: 0;
transition-delay: 0.3s;
}
.btn1 span::before {
@extend %btnLine1;
height: $lineWidth;
width: 0;
bottom: 0;
right: 0;
transition-delay: 0.2s;
}
.btn1 span::after {
@extend %btnLine1;
width: $lineWidth;
height: 0;
bottom: 0;
left: 0;
transition-delay: 0.1s;
}
// button line hovered
// common
%btnLine1HoverW {
width: 100%;
transition: all 0.1s;
}
%btnLine1HoverH {
height: 100%;
transition: all 0.1s;
}
// each
.btn1:hover::before {
@extend %btnLine1HoverW;
}
.btn1:hover::after {
@extend %btnLine1HoverH;
transition-delay: 0.1s;
}
.btn1:hover span::before {
@extend %btnLine1HoverW;
transition-delay: 0.2s;
}
.btn1:hover span::after {
@extend %btnLine1HoverH;
transition-delay: 0.3s;
}
.btn1:hover {
transition-delay: 0.4s;
}
/* btn2 */
// button line neutral
// common
%btnLine2 {
content: '';
position: absolute;
transition: all 0.2s;
background-color: #555;
}
//each
.btn2::before {
@extend %btnLine2;
height: $lineWidth;
width: 0;
top: 0;
left: 0;
transition-delay: 0.4s;
}
.btn2::after {
@extend %btnLine2;
width: $lineWidth;
height: 0;
top: 0;
right: 0;
transition-delay: 0.2s;
}
.btn2 span::before {
@extend %btnLine2;
height: $lineWidth;
width: 0;
bottom: 0;
right: 0;
transition-delay: 0.4s;
}
.btn2 span::after {
@extend %btnLine2;
width: $lineWidth;
height: 0;
bottom: 0;
left: 0;
transition-delay: 0.2s;
}
// button line hovered
// common
%btnLine2HoverW {
width: 100%;
transition: all 0.2s;
}
%btnLine2HoverH {
height: 100%;
transition: all 0.2s;
}
// each
.btn2:hover::before {
@extend %btnLine2HoverW;
}
.btn2:hover::after {
@extend %btnLine2HoverH;
transition-delay: 0.2s;
}
.btn2:hover span::before {
@extend %btnLine2HoverW;
}
.btn2:hover span::after {
@extend %btnLine2HoverH;
transition-delay: 0.2s;
}
.btn2:hover {
transition-delay: 0.4s;
}
/* btn3 */
// button line neutral
// common
$lineDist: -0.4em;
%btnLine3 {
content: '';
position: absolute;
transition: all 0.2s;
background-color: #555;
}
//each
.btn3::before {
@extend %btnLine3;
height: $lineWidth;
width: 0;
top: 0;
left: 0;
transition-delay: 0.2s;
}
.btn3::after {
@extend %btnLine3;
width: $lineWidth;
height: 0;
bottom: 0;
right: 0;
transition-delay: 0.2s;
}
.btn3 span::before {
@extend %btnLine3;
height: $lineWidth;
width: 0;
bottom: 0;
right: 0;
transition-delay: 0.2s;
}
.btn3 span::after {
@extend %btnLine3;
width: $lineWidth;
height: 0;
top: 0;
left: 0;
transition-delay: 0.2s;
}
// button line hovered
// common
%btnLine3HoverW {
width: 0.7em;
transition: all 0.2s;
}
%btnLine3HoverH {
height: 0.7em;
transition: all 0.2s;
}
%LT {
top: $lineDist;
left: $lineDist;
}
%RB {
bottom: $lineDist;
right: $lineDist;
}
// each
.btn3:hover::before {
@extend %btnLine3HoverW;
@extend %LT;
}
.btn3:hover::after {
@extend %btnLine3HoverH;
@extend %RB;
transition-delay: 0.2s;
}
.btn3:hover span::before {
@extend %btnLine3HoverW;
transition-delay: 0.2s;
@extend %RB;
}
.btn3:hover span::after {
@extend %btnLine3HoverH;
@extend %LT;
}
.btn3:hover {
transition-delay: 0.4s;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.