@import url(https://fonts.googleapis.com/css?family=Open+Sans:400|Raleway:300);
$btn-width: 250px !default;
$btn-height: 80px !default;
$btn-full: $btn-height+$btn-width !default;
$btn-half: $btn-full/2 !default;
$bg-color: #eeeeee !default;
html {
padding-top: 50px;
font-family: 'Open Sans', Helvetica, arial, sans-serif;
text-align: center;
background-color: $bg-color;
*,
*:before,
*:after {
box-sizing: border-box;
transition: 0.5s ease-in-out;
}
i,em,
b,strong,
span {
transition: none;
}
}
*:before,
*:after {
z-index: -1;
}
h1,
h4 {
font-family: 'Raleway', 'Open Sans', sans-serif;
margin: 0;
line-height: 1;
}
a {
text-decoration: none;
line-height: $btn-height;
color: black;
}
.centerer {
width: 100%;
max-width: 600px;
margin: 0 auto;
padding: 0 1rem
}
@media (min-width: 600px) {
.wrap {
width: 50%;
float: left;
}
}
[class^="btn-"] {
position: relative;
display: block;
overflow: hidden;
@include size(100%, $btn-height);
max-width: $btn-width;
margin: 1rem auto;
text-transform: uppercase;
border: 1px solid currentColor;
}
.btn-0 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before {
content: '';
@include absolute(0,0,0,0);
background-color: $btn-color-dark;
transform: translateX(-100%);
}
&:hover {
color: tint($btn-color, 75%);
&:before {
transform: translateX(0);
}
}
}
.btn-1 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before {
content: '';
@include absolute(0,-50px,0,0);
border-right: 50px solid transparent;
border-bottom: $btn-height solid $btn-color-dark;
transform: translateX(-100%);
}
&:hover {
color: tint($btn-color, 75%);
&:before {
transform: translateX(0);
}
}
}
.btn-1-2 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after {
content: '';
@include absolute(0,0,0,0);
border-bottom: $btn-height solid $btn-color-dark;
}
&:before {
right: -50px;
border-right: 50px solid transparent;
transform: translateX(-100%);
}
&:after {
left: -50px;
border-left: 50px solid transparent;
transform: translateX(100%);
}
&:hover {
color: tint($btn-color, 75%);
&:before { transform: translateX(-40%); }
&:after { transform: translateX(40%); }
}
}
.btn-2 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after {
content: '';
@include absolute(0,0,0,0);
}
&:before {
right: -50px;
border-right: 50px solid transparent;
border-bottom: $btn-height solid $btn-color-dark;
transform: translateX(-100%);
}
&:after {
left: -50px;
border-left: 50px solid transparent;
border-top: $btn-height solid $btn-color-dark;
transform: translateX(100%);
}
&:hover {
color: tint($btn-color, 75%);
&:before { transform: translateX(-49%); }
&:after { transform: translateX(49%); }
}
}
.btn-3 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
&:before,
&:after {
content: '';
@include absolute(0,0,0,0);
border-top: $btn-height/2 solid $btn-color-dark;
border-bottom: $btn-height/2 solid $btn-color-dark;
}
&:before {
border-right: $btn-height/2 solid transparent;
transform: translateX(-100%);
}
&:after {
border-left: $btn-height/2 solid transparent;
transform: translateX(100%);
}
&:hover {
color: tint($btn-color, 75%);
&:before { transform: translateX(-30%); }
&:after { transform: translateX(30%); }
}
}
.btn-4 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after,
span:before,
span:after {
content: '';
@include absolute(0,0,0,0);
background-color: $btn-color-dark;
}
&:before { transform: translate(-100%, -100%); }
&:after { transform: translate(-100%, 100%); }
span:before { transform: translate(100%, -100%); }
span:after { transform: translate(100%, 100%); }
&:hover {
color: tint($btn-color, 75%);
&:before { transform: translate(-50%, -50%); }
&:after { transform: translate(-50%, 50%); }
span:before { transform: translate(50%, -50%); }
span:after { transform: translate(50%, 50%); }
}
}
.btn-5 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
@include triangle(up-right, 0, $btn-color-dark, true);
@include triangle(down-left, 0, $btn-color-dark, true, before);
&:before,
&:after {
content: '';
position: absolute;
width: 0;
height: 0;
border: 0 solid;
transform: rotate(360deg);
}
&:before {
bottom: 0;
left: 0;
border-color: transparent transparent transparent $btn-color-dark;
}
&:after {
top: 0;
right: 0;
border-color: transparent $btn-color-dark transparent transparent;
}
&:hover {
color: tint($btn-color, 75%);
&:before,
&:after {
border-width: $btn-height $btn-width*1.05;
}
}
}
.btn-6 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
span {
@include absolute();
display: block;
@include size(0);
border-radius: 50%;
background-color: $btn-color-dark;
transition: width 0.4s ease-in-out, height 0.4s ease-in-out;
transform: translate(-50%, -50%);
z-index: -1;
}
&:hover {
color: tint($btn-color, 75%);
span {
@include size(225%, $btn-width*2.25);
}
}
&:active {
background-color: $btn-color;
}
}
.btn-7 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after,
span:before,
span:after {
content: '';
@include absolute(0);
@include size(25.25%, 0);
background-color: $btn-color-dark;
}
&:before { left: 0; }
&:after { left: 50%; }
span {
&:before,
&:after {
top: auto;
bottom: 0;
}
&:before { left: 25%; }
&:after { left: 75%; }
}
&:hover {
color: tint($btn-color, 75%);
&:before,
&:after,
span:before,
span:after {
height: $btn-height;
}
}
}
.btn-8 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after {
content: '';
@include absolute(0,0,0,0);
background-color: $btn-color-dark;
}
&:before { transform: translateY(-100%); }
&:after { transform: translateY(100%); }
&:hover {
color: tint($btn-color, 75%);
&:before { transform: translateY(-50%); }
&:after { transform: translateY(50%); }
}
}
.btn-9 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after,
span:before,
span:after {
content: '';
@include absolute(0,null,null,0);
@include size(100%, 0);
background-color: rgba($btn-color-dark, 0.25);
transition: 0.4s ease-in-out;
}
&:after,
span:before {
top: auto;
bottom: 0;
}
span:before,
span:after {
transition-delay: 0.4s;
}
&:hover {
color: tint($btn-color, 75%);
&:before,
&:after,
span:before,
span:after {
height: $btn-height;
}
}
&:active {
background-color: $btn-color;
}
}
.btn-10 {
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after,
span:before,
span:after {
content: '';
@include absolute(0,null,null,0);
@include size(0, $btn-height);
background-color: rgba($btn-color-dark, 0.25);
transition: 0.4s;
}
&:after,
span:before {
left: auto;
right: 0;
}
span:before,
span:after {
transition-delay: 0.4s;
}
&:hover {
color: tint($btn-color, 75%);
&:before,
&:after,
span:before,
span:after {
width: $btn-width;
}
}
&:active {
background-color: $btn-color;
}
}
@keyframes criss-cross-left {
0% {
left: -20px;
}
50% {
left: 50%;
@include size(20px);
}
100% {
left: 50%;
@include size($btn-width*1.5);
}
}
@keyframes criss-cross-right {
0% {
right: -20px;
}
50% {
right: 50%;
@include size(20px);
}
100% {
right: 50%;
@include size($btn-width*1.5);
}
}
.btn-11 {
position: relative;
$btn-color: random-color($max:200);
$btn-color-dark: shade($btn-color, 40%);
color: tint($btn-color);
&:before,
&:after {
@include absolute(50%);
content: '';
@include size(20px);
background-color: $btn-color;
border-radius: 50%;
}
&:before {
left: -20px;
transform: translate(-50%, -50%);
// animation: criss-cross-left 0.8s reverse;
}
&:after {
right: -20px;
transform: translate(50%, -50%);
// animation: criss-cross-right 0.8s reverse;
}
&:hover {
color: tint($btn-color, 75%);
&:before,
&:after {
// @include size($btn-width);
}
&:before {
animation: criss-cross-left 0.8s both;
animation-direction: alternate;
}
&:after {
animation: criss-cross-right 0.8s both;
animation-direction: alternate;
}
}
}
View Compiled