Floating social icon buttons | CSS Only
A Pen by Håvard Brynjulfsen on CodePen.
<ul> | |
<li> | |
<a href="#" class="spotify"><span>Spotify</span><i class="entypo-spotify"></i></a> | |
</li> | |
<li> | |
<a href="#" class="soundcloud"><span>Soundcloud</span><i class="entypo-soundcloud"></i></a> | |
</li> | |
<li> | |
<a href="#" class="skype"><span>Skype</span><i class="entypo-skype"></i></a> | |
</li> | |
<li> | |
<a href="#" class="dribbble"><span>Dribbble</span><i class="entypo-dribbble"></i></a> | |
</li> | |
</ul> | |
<div> | |
<h1>Floating social icon buttons</h1> | |
<p>Icon credit to <a href="http://danielbruce.se/">Daniel Bruce</a> and <a href="http://weloveiconfonts.com/">We Love Icons</a></p> | |
</div> |
@import url(http://weloveiconfonts.com/api/?family=entypo); | |
@import url('https://fonts.googleapis.com/css?family=Quicksand'); | |
*, | |
*:before, | |
*:after { | |
box-sizing: border-box; | |
} | |
html { | |
font-size: 18px; | |
} | |
body { | |
font-family: "Quicksand", sans-serif; | |
font-size: 1em; | |
line-height: 1.6; | |
font-weight: 600; | |
background: #f0f0f0; | |
} | |
ul { | |
list-style: none; | |
position: absolute; | |
top: 50%; | |
left: 0%; | |
transform: translateY(-50%); | |
li { | |
a { | |
display: block; | |
margin-left: -2px; | |
height: 60px; | |
width: 60px; | |
border-radius: 0 25px 25px 0; | |
border: 2px solid #000; | |
background: #FFF; | |
margin-bottom: 1em; | |
transition: all .4s ease; | |
color: #2980b9; | |
text-decoration: none; | |
line-height: 60px; | |
position: relative; | |
&:hover { | |
cursor: pointer; | |
width: 180px; | |
color: #fff; | |
span { | |
left: 0; | |
} | |
} | |
span { | |
padding: 0 30px 0 15px; | |
position: absolute; | |
left: -120px; | |
transition: left .4s ease; | |
} | |
i { | |
position: absolute; | |
top: 50%; | |
right: 20px; | |
transform: translateY(-50%); | |
font-size: 1.5em; | |
} | |
} | |
.spotify { | |
background: rgba(#27ae60, .1); | |
border-color: #27ae60; | |
color: #27ae60; | |
&:hover { | |
background: rgba(#27ae60, 1); | |
} | |
} | |
.soundcloud { | |
background: rgba(#e67e22, .1); | |
border-color: #e67e22; | |
color: #e67e22; | |
&:hover { | |
background: rgba(#e67e22, 1); | |
} | |
} | |
.skype { | |
background: rgba(#22A7F0, .1); | |
border-color: #22A7F0; | |
color: #22A7F0; | |
&:hover { | |
background: rgba(#22A7F0, 1); | |
} | |
} | |
.dribbble { | |
background: rgba(#D2527F, .1); | |
border-color: #D2527F; | |
color: #D2527F; | |
&:hover { | |
background: rgba(#D2527F, 1); | |
} | |
} | |
} | |
} | |
/* entypo */ | |
[class*="entypo-"]:before { | |
font-family: 'entypo', sans-serif; | |
} | |
div { | |
text-align: center; | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -60%); | |
h1 { | |
font-weight: 600; | |
font-size: 2.4em; | |
color: #303030; | |
margin-bottom: .5em; | |
} | |
p { | |
color: #999; | |
font-weight: 400; | |
font-size: 1.2em; | |
} | |
a { | |
color: #4183D7; | |
text-decoration: none; | |
font-weight: 600; | |
padding-bottom: 2px; | |
border-bottom: 2px dotted #4183D7; | |
transition: all .25s ease; | |
&:hover { | |
color: #D2527F; | |
border-color: #D2527F; | |
} | |
} | |
} |