A Pen by Hugo Darby-Brown on CodePen.
Created
July 1, 2014 19:47
-
-
Save anonymous/75c33cea0f7af3493e18 to your computer and use it in GitHub Desktop.
A Pen by Hugo Darby-Brown.
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
<a href="#" class="fa fa-twitter"></a> | |
<a href="#" class="fa fa-facebook"></a> | |
<a href="#" class="fa fa-youtube"></a> | |
<a href="#" class="fa fa-soundcloud"></a> | |
<a href="#" class="fa fa-pinterest"></a> |
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
@import "compass/css3"; | |
$icon-size: 3em; | |
*, *:after, *:before { | |
box-sizing: border-box; | |
} | |
$brands: ( | |
twitter: #00acee \f099, | |
facebook: #3b5998 \f09a, | |
pinterest: #cb2027 \f0d2, | |
youtube: #b00 \f167, | |
soundcloud: #FF5700 \f1be | |
); | |
.fa { | |
height: 2em; | |
font-size: $icon-size; | |
overflow: hidden; | |
margin: 0.5em; | |
position: relative; | |
text-decoration: none; | |
width: 2em; | |
-webkit-backface-visibility: hidden; | |
&:before, &:after { | |
left: 0; | |
position: absolute; | |
text-align: center; | |
transition: 0.5s; | |
top: 50%; | |
width: 100%; | |
} | |
&:before { | |
color: white; | |
transform: translate3D(0, -50%, 0); | |
z-index: 2; | |
} | |
&:after { | |
padding-bottom: 25%; | |
padding-top: 300%; | |
top: 0; | |
} | |
&:hover { | |
&:after { | |
transform: translate3D(0, -73%, 0); | |
} | |
&:before { | |
transform: translate3D(0, -250%, 0); | |
} | |
} | |
} | |
@each $brand, $properties in $brands { | |
$color: nth($properties, 1); | |
$icon: nth($properties, 2); | |
.fa-#{$brand} { | |
&:after { | |
background-image: linear-gradient($color 25%, white 75%); | |
content: '#{$icon}'; | |
color: $color; | |
} | |
} | |
} | |
// Demo styles | |
html { | |
background: radial-gradient(#222, #000); | |
height: 100%; | |
text-align: center; | |
} | |
body { | |
position: absolute; | |
top: 50%; | |
transform: translateY(-50%); | |
width: 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment