a.ghostButton-simple(href="#") Hover Me
a.ghostButton-3d(href="#")
.front Hover Me
.back Thanks!
View Compiled
@bg: #1abc9c;
@c: white;
// GHOST BUTTON MIXIN - SIMPLE
.ghostButton-simple(@c:@c,@bg:@bg,@b:3px,@h:70px,@t:.3s){
@w: @h*3;
@f: @h/3;
@m: @h/10;
display: inline-block;
position: relative;
color: @c;
width: @w;
height: @h;
line-height: @h;
font-size: @f;
text-align: center;
text-transform: uppercase;
text-decoration: none;
font-weight: bold;
transition: @t;
&:after,
&:before {
content: "";
position: absolute;
}
&:after {
background-color: @c;
top: 50%;
left: 50%;
width: 0;
height: 0;
transform: translate(-50%,-50%);
transition: @t;
opacity: 1;
}
&:before {
top: -(@m+@b);
left: -(@m+@b);
bottom: -(@m+@b);
right: -(@m+@b);
border: @b solid @c;
}
&:hover {
background-color: @c;
color: @bg;
&:after {
width: @w+(@m+@b);
height: @h+(@m+@b);
opacity: 0;
}
}
}
// USE:
.ghostButton-simple {
.ghostButton-simple();
}
// GHOST BUTTON MIXIN - 3D
.ghostButton-3d(@c:@c,@bg:@bg,@b:3px,@h:70px,@t:.3s) {
@w: @h*3;
@f: @h/3;
@m: @h/10;
position: relative;
top: 0;
left: 0;
display: inline-block;
width: @w;
height: @h;
transition: @t;
perspective: 1000;
transform-style: preserve-3d;
&:before {
content: "";
position: absolute;
top: -(@m+@b);
left: -(@m+@b);
bottom: -(@m+@b);
right: -(@m+@b);
border: @b solid @c;
transition: @t;
transform-style: preserve-3d;
}
.front, .back {
position: absolute;
backface-visibility: hidden;
color: @c;
width: @w;
height: @h;
line-height: @h;
font-size: @f;
text-align: center;
text-transform: uppercase;
text-decoration: none;
font-weight: bold;
transition: @t;
}
.front {
z-index: 2;
}
.back {
transform: rotate3d(45, 45, 0, 180deg);
background-color: @c;
color: @bg;
}
&:hover {
transform: rotate3d(45, 45, 0, 180deg);
}
&:hover:before {
transform: rotate3d(45, -45, 0, 180deg);
}
}
// USE:
.ghostButton-3d {
.ghostButton-3d();
}
// GENERAL STYLES
@import url(https://fonts.googleapis.com/css?family=Cabin:700);
body {
padding: 3em;
background-color: @bg;
font-family: 'Cabin', sans-serif;
}
a {
float: left;
margin: 0 2em 2em 0;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.