Skip to content

Instantly share code, notes, and snippets.

@CodeMyUI
Created November 22, 2016 12:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeMyUI/80e081989be2f35cebd9666903ed63fc to your computer and use it in GitHub Desktop.
Save CodeMyUI/80e081989be2f35cebd9666903ed63fc to your computer and use it in GitHub Desktop.
Cool buttons
<div class="wrap">
<a href="#" class="btn">Cool Button</a>
<a href="#" class="btn2">Cool Button</a>
<a href="#" class="btn3">Cool Button</a>
<a href="#" class="btn4">Cool Button</a>
<a href="#" class="btn5">Cool Button</a>
<a href="#" class="btn6">Cool Button</a></a>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
@import "bourbon";
/* Demo styling */
body {
background-color: #eee;
box-sizing: border-box;
font-family: "Futura PT", "Futura", sans-serif;
-webkit-font-smoothing: antialiased;
}
/* Buttons at the center */
.wrap {
position: absolute;
top: 50%;
left: 50%;
margin-top: -259px;
margin-left: -89px;
text-align: center;
}
/* General styling for the links */
a {
padding: 15px 30px;
text-decoration: none;
font-size: 18px;
display: block;
margin: 20px auto;
}
/* BUTTON 1 */
.btn, .btn:link, .btn:visited {
color: #2c3e50;
line-height: 1em;
color: inherit;
text-decoration: none;
display: inline-block;
border-radius: 4px;
background-color: #fff;
background-color: rgba(255,255,255, 0);
box-shadow: 0 0 0 0 #2c3e50 inset, 0.3em 0.2em 0 0 #bbb;
border: 0.2em solid #2c3e50;
padding: 0.8em;
text-align: center;
transition: 0.25s box-shadow, 0.25s transform;
&:hover {
box-shadow: 0 4em 0 0 #2c3e50 inset, 0em 0em 0 0 #bbb;
transform: translate(0.3em, 0.2em);
color: #fff;
}
}
/* BUTTON 2 */
.btn2, .btn2:link, .btn2:visited {
background-color: #5b657c;
border: none;
border-radius: 3px;
box-shadow: 0 -3px 0 rgba(0,0,0,0.15) inset;
color: #fff;
letter-spacing: .1em;
cursor: pointer;
position: relative;
text-align: center;
text-transform: uppercase;
vertical-align: middle;
white-space: nowrap;
transition-property: transform;
transform: translateZ(0);
transition: box-shadow 0.5s cubic-bezier(0.390, 0.500, 0.150, 1.360);
&:hover {
box-shadow: 0 0 0 28px rgba(0,0,0,0.25) inset;
}
&:active {
transform: translateY(3px);
}
}
/* BUTTON 3 */
.btn3, .btn3:link, .btn3:visited {
color: #333;
font-size: .8em;
letter-spacing: .1em;
text-transform: uppercase;
min-width: 100px;
max-width: 60%;
position: relative;
margin: 0 auto;
border: 2px solid transparent;
transition: all .2s cubic-bezier(0.455, 0.030, 0.515, 0.955);
&:after, &:before {
content: "";
position: absolute;
left: - 1em;
top: -2px;
height: 3.3em;
width: 0;
border: 1px solid #c75842;
transition: inherit;
}
&:after {
left: auto;
right: -1em;
}
&:hover {
border-color: #c75842;
transition: border-color .2s .2s cubic-bezier(0.455, 0.030, 0.515, 0.955);
&:after, &:before {
right: -2px;
transition: all .2s cubic-bezier(0.455, 0.030, 0.515, 0.955);
}
&:before {
left: -2px;
right: auto;
}
}
}
/* BUTTON 4 */
.btn4, .btn4:link, .btn4:visited {
background: #f1c40f;
color: #fefefe;
transition: box-shadow .18s ease;
&:hover {
box-shadow: inset 0 0 0 5px darken(#f1c40f, 10%);
}
}
/* BUTTON 5 */
.btn5, .btn5:link, .btn5:visited {
border: none;
outline: none;
color: #fefefe;
background-color: #9b59b6;
border-radius: 3px;
&:hover, &:focus {
transition-timing-function: cubic-bezier(0.6, 4, 0.3, 0.8);
animation: gelatine 0.5s 1;
}
}
// Bourbon mixin
@include keyframes(gelatine) {
from,to {
@include transform(scale(1, 1));
}
25% {
@include transform(scale(0.9, 1.1));
}
50% {
@include transform(scale(1.1, 0.9));
}
75% {
@include transform(scale(0.95, 1.05));
}
from,to {
@include transform(scale(1, 1));
}
25% {
@include transform(scale(0.9, 1.1));
}
50% {
@include transform(scale(1.1, 0.9));
}
75% {
@include transform(scale(0.95, 1.05));
}
}
/* BUTTON 6 */
.btn6, .btn6:link, .btn6:visited {
padding: 13px 0;
border: 1px solid #333;
color: #333;
font-weight: 700;
text-transform: uppercase;
font-size: 13px;
letter-spacing: 3px;
transition: all .2s ease-in-out;
&:hover {
background: #333;
border: 1px solid #333;
color: #fefefe;
border-radius: 30px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment