Collection of buttons I've made, with some great hovers and animations.
Created
May 26, 2016 19:38
-
-
Save C-Rodg/03215c4c8fe6c3ecb38bec4b804c6ed0 to your computer and use it in GitHub Desktop.
BUTTONS BUTTONS BUTTONS!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="contain"> | |
<div class="row r1"> | |
<button class="btn-set-1 outline"> | |
Outline | |
</button> | |
<button class="btn-set-1 inside-out"> | |
Inside Out | |
</button> | |
<button class="btn-set-1 grow"> | |
Grow | |
</button> | |
</div> | |
<div class="row r2"> | |
<button class="btn-set-2 b2green">A</button> | |
<button class="btn-set-2 b2red">B</button> | |
<button class="btn-set-2 b2blue">C</button> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ---------------Overrides --------------------------------*/ | |
*, *::before, *::after { | |
box-sizing: border-box; | |
} | |
body { | |
font-family: sans-serif; | |
font-size: 22px; | |
background: #333; | |
} | |
button { | |
background: none; | |
border: 0; | |
outline: 0; | |
margin-right: 40px; | |
} | |
.contain { | |
text-align: center; | |
max-width:1200px; | |
width: 70%; | |
margin: 25px auto; | |
} | |
.row { | |
padding-top: 15px; | |
padding-bottom: 15px; | |
} | |
/*-----------Button Set 1 ---------------------------------------*/ | |
.r1 { | |
background: #3498db; | |
border-radius: 2px; | |
} | |
$s1hoverColor : #fff; | |
$s1origColor : #16405B; | |
.btn-set-1 { | |
border: 2px solid $s1origColor; | |
color: $s1origColor; | |
cursor: pointer; | |
display: inline-block; | |
height: 60px; | |
line-height: 60px; | |
padding: 0 20px; | |
position: relative; | |
text-align: center; | |
vertical-align: middle; | |
transition: 0.4s; | |
&:hover { | |
border: 2px solid rgba(22,64,91,0); | |
color: $s1hoverColor; | |
&::before, | |
&::after { | |
transform: scale(1); | |
} | |
} | |
&::before, | |
&::after { | |
box-sizing: border-box; | |
content: ''; | |
height: 100%; | |
left: 0; | |
position: absolute; | |
top: 0; | |
width: 100%; | |
z-index: 3; | |
transform: scale(0); | |
transition: 0.4s; | |
} | |
} | |
.outline { | |
&::before { | |
border-bottom: 3px solid $s1hoverColor; | |
border-left: 3px solid $s1hoverColor; | |
transform-origin: 0 100%; | |
} | |
&::after { | |
border-top: 3px solid $s1hoverColor; | |
border-right: 3px solid $s1hoverColor; | |
transform-origin: 100% 0; | |
} | |
} | |
.inside-out { | |
&::before { | |
border-bottom: 3px solid $s1hoverColor; | |
border-left: 3px solid $s1hoverColor; | |
transform-origin: 100% 0; | |
} | |
&::after { | |
border-top: 3px solid $s1hoverColor; | |
border-right: 3px solid $s1hoverColor; | |
transform-origin: 0 100%; | |
} | |
} | |
.grow { | |
&::before { | |
border-bottom: 3px solid $s1hoverColor; | |
border-left: 3px solid $s1hoverColor; | |
transform-origin: 50% 50%; | |
} | |
&::after { | |
border-top: 3px solid $s1hoverColor; | |
border-right: 3px solid $s1hoverColor; | |
transform-origin: 50% 50%; | |
} | |
} | |
/*-----------Button Set 2 ---------------------------------------*/ | |
.r2 { | |
background: #fff; | |
} | |
.btn-set-2 { | |
width: 100px; | |
height: 100px; | |
border-radius: 50%; | |
color: #fff; | |
box-shadow: 0 0 10px 1px rgba(0, 0, 0, 0.25); | |
transition: all 0.5s ease-in-out; | |
} | |
.b2green { | |
background-color: #16a085; | |
&:hover { | |
animation: pulseGreen 0.5s linear 1; | |
animation-fill-mode: forwards; | |
} | |
} | |
.b2red { | |
background-color: #c0392b; | |
&:hover { | |
animation: pulseRed 0.5s linear 1; | |
animation-fill-mode: forwards; | |
} | |
} | |
.b2blue { | |
background-color: #2980b9; | |
&:hover { | |
animation: pulseBlue 0.5s linear 1; | |
animation-fill-mode: forwards; | |
} | |
} | |
@keyframes pulseGreen { | |
0% { | |
box-shadow: 0 0 0 0 rgba(22,160,133, 0.75); | |
} | |
50% { | |
box-shadow: 0 0 0 3px rgba(22,160,133, 0.5); | |
} | |
100% { | |
box-shadow: 0 0 0 6px rgba(22,160,133, 0.25); | |
} | |
} | |
@keyframes pulseRed { | |
0% { | |
box-shadow: 0 0 0 0 rgba(192,47,53, 0.75); | |
} | |
50% { | |
box-shadow: 0 0 0 3px rgba(192,47,53, 0.5); | |
} | |
100% { | |
box-shadow: 0 0 0 6px rgba(192,47,53, 0.25); | |
} | |
} | |
@keyframes pulseBlue { | |
0% { | |
box-shadow: 0 0 0 0 rgba(41,128,185, 0.75); | |
} | |
50% { | |
box-shadow: 0 0 0 3px rgba(41,128,185, 0.5); | |
} | |
100% { | |
box-shadow: 0 0 0 6px rgba(41,128,185, 0.25); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment