Created
September 7, 2015 09:22
-
-
Save angrycat/f6803fd0778a073e7fdf to your computer and use it in GitHub Desktop.
Buttons
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> | |
</head> | |
<body> | |
<div class="buttons"> | |
<a href="#0" class="btn btn1"> | |
<i class="fa fa-camera-retro fa-fw"></i> | |
<span class="text"> | |
Сфоткаться | |
</span> | |
</a> | |
<a href="#0" class="btn btn1"> | |
<i class="fa fa-home fa-fw"></i> | |
<span class="text"> | |
Домой | |
</span> | |
</a> | |
</div> | |
<div class="buttons"> | |
<a href="#0" class="btn btn2"> | |
<i class="fa fa-pencil fa-fw"></i> | |
<span class="text"> | |
Редактировать | |
</span> | |
</a> | |
<a href="#0" class="btn btn2 btn-red"> | |
<i class="fa fa-cog fa-fw"></i> | |
<span class="text"> | |
Настройки | |
</span> | |
</a> | |
<a href="#0" class="btn btn2 btn-blue"> | |
<i class="fa fa-check fa-fw"></i> | |
<span class="text"> | |
Сохранить | |
</span> | |
</a> | |
<a href="#0" class="btn btn2 btn-orange"> | |
<i class="fa fa-trash fa-fw"></i> | |
<span class="text"> | |
Удалить | |
</span> | |
</a> | |
</div> | |
</body> | |
</html> |
This file contains 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
@base-fz: 16; | |
@button-fz: 20; | |
@button-padding: 10; | |
@button-rs: 5; | |
@toRems: (1 / @base-fz) + 0rem; | |
@color1: #4ECDC4; | |
@color2: #fff; | |
@color3: #556270; | |
@time: 500ms ease; | |
html { | |
font-size: @base-fz + 0px; | |
line-height: 1; | |
font-family: sans-serif; | |
} | |
body { | |
padding: 3em; | |
} | |
*,*:before,*:after { | |
box-sizing: border-box; | |
} | |
.buttons { | |
word-spacing: -5 * @toRems; | |
> * { | |
word-spacing: normal; | |
} | |
.btn { | |
margin-right: @button-padding * @toRems; | |
} | |
} | |
a.btn1 { | |
display: inline-block; | |
vertical-align: top; | |
padding: @button-padding * @toRems; | |
border: none; | |
border-radius: @button-rs * @toRems; | |
overflow: hidden; | |
font-size: @button-fz * @toRems; | |
line-height: @button-fz * @toRems; | |
text-decoration: none; | |
background-color: @color1; | |
color: @color2; | |
word-spacing: -5 * @toRems; | |
white-space: nowrap; | |
max-width: (@button-fz + @button-padding*2 ) * @toRems; | |
max-height: (@button-fz + @button-padding*2) * @toRems; | |
transition: max-width @time, color @time; | |
position: relative; | |
z-index: 1; | |
&:before { | |
content: ''; | |
position: absolute; | |
z-index: -1; | |
top: 0; | |
bottom: 0; | |
left: 50%; | |
right: 50%; | |
background-color: @color2; | |
border: 2px solid @color1; | |
border-radius: @button-rs; | |
opacity: 0; | |
transition: left @time, right @time, opacity @time; | |
} | |
.fa, .text { | |
display: inline-block; | |
word-spacing: normal; | |
} | |
.fa { | |
text-align: center; | |
width: @button-fz * @toRems; | |
} | |
.text { | |
margin-left: @button-padding * @toRems | |
} | |
&:hover { | |
max-width: 999px; | |
} | |
&:active { | |
color: @color1; | |
&:before { | |
left: 0; | |
right: 0; | |
opacity: 1; | |
} | |
} | |
} | |
.btn2 { | |
display: inline-block; | |
vertical-align: top; | |
padding: @button-padding * @toRems; | |
border: none; | |
border-radius: @button-rs * @toRems; | |
font-size: @button-fz * @toRems; | |
line-height: @button-fz * @toRems; | |
text-decoration: none; | |
background-color: @color1; | |
color: @color2; | |
width: (@button-fz + @button-padding*2 ) * @toRems; | |
height: (@button-fz + @button-padding*2) * @toRems; | |
position: relative; | |
z-index: 1; | |
transition: color @time; | |
&:before { | |
content: ''; | |
z-index: -1; | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
background-color: @color2; | |
opacity: 0; | |
transform: scale(.2); | |
transition: transform @time, opacity @time; | |
} | |
.fa { | |
text-align: center; | |
width: @button-fz * @toRems; | |
} | |
.text { | |
display: block; | |
text-align: center; | |
font-size: @button-fz * .5 * @toRems; | |
padding: (@button-padding / 2 * @toRems) (@button-padding * @toRems); | |
font-weight: 300; | |
letter-spacing: 1 * @toRems; | |
text-transform: uppercase; | |
background-color: @color3; | |
color: @color2; | |
position: absolute; | |
border-radius: @button-rs * @toRems; | |
top: -20 * @toRems; | |
left: 50%; | |
right: auto; | |
transform: translate(-100%, -50%); | |
-webkit-transform: translate(-50%, -100%); | |
opacity: 0; | |
transition: top @time, opacity @time; | |
&:before { | |
content: ''; | |
position: absolute; | |
bottom: @button-padding * -@toRems; | |
left: 50%; | |
right: auto; | |
transform: translateX(-50%); | |
background-color: transparent; | |
border-width: @button-padding / 2 * @toRems; | |
border-style: solid; | |
border-color: transparent; | |
border-top-color: @color3; | |
} | |
} | |
&:hover { | |
.text { | |
top: -10 * @toRems; | |
opacity: 1; | |
} | |
} | |
&:active { | |
color: @color1; | |
&:before { | |
transform: scale(1); | |
opacity: 1; | |
} | |
} | |
} | |
.btn-var(@bg, @color, @text) { | |
color: @color; | |
background-color: @bg; | |
&:before { | |
background-color: @color; | |
} | |
.text { | |
background-color: @text; | |
color: @color; | |
} | |
&:active { | |
color: @bg; | |
} | |
} | |
.btn-red { | |
.btn-var(#FF6B6B, #fff, @color3); | |
} | |
.btn-blue { | |
.btn-var(#69D2E7, #fff, @color3); | |
} | |
.btn-orange { | |
.btn-var(#FA6900, #fff, @color3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment