<div class="contents">text contents</div>
<ul class="cp_snslink03">
<li class="cp_link facebook"><a href="#"><div class="nav-label"><span>facebook Button</span></div></a></li>
<li class="cp_link twitter"><a href="#"><div class="nav-label"><span>X Button</span></div></a></li>
<li class="cp_link instagram"><a href="#"><div class="nav-label"><span>instagram Button</span></div></a></li>
</ul>
body {
/*設置する親要素ページ全体ならbodyなど*/
position: relative;
height: 100vh;
margin: 0;
padding: 0;
}
.contents {
/*サンプルはfixedの確認のためにheight指定しています。*/
height: 2000px;
}
/*SNSリンクブロックの位置設定*/
.cp_snslink03 {
position: fixed;
top: 50%;
right: 0;
transform: translateY(-50%);
display: block;
overflow: hidden;
margin: 0;
padding: 0 0 0 5px;
}
/*それぞれのSNS iconの設定*/
.cp_snslink03 .cp_link {
position: relative;
right: -148px;
margin: 10px 0;
padding: 5px;
background: #0097A7;
border: 1px dashed #ffffff;
border-right: none;
box-shadow: 0px 0px 0px 3px #0097A7;
cursor: pointer;
transition: right 0.6s ease-in-out;
}
.cp_snslink03 .cp_link .nav-label {
margin-right: 10px;
padding: 0 0 0 25px;
}
.cp_snslink03 .cp_link.facebook::before,
.cp_snslink03 .cp_link.twitter::before,
.cp_snslink03 .cp_link.instagram::before {
position: absolute;
content: '';
top: 50%;
left: 5px;
transform: translateY(-50%);
background-size: contain;
background-repeat: no-repeat;
width: 1em;
height: 1em;
}
/*facebook*/
.cp_snslink03 .cp_link.facebook::before {
background-image: url(facebook_logo_secondary.svg);
}
/*twitter*/
.cp_snslink03 .cp_link.twitter::before {
background-image: url(x-logo.svg);
}
/*instagram*/
.cp_snslink03 .cp_link.instagram::before {
background-image: url(instagram_glyph_white.svg);
}
.cp_snslink03 .cp_link:hover {
right: 0;
background: #00bcd4;
box-shadow: 0px 0px 0px 3px #00bcd4;
}
.cp_snslink03 .cp_link a {
text-decoration: none;
color: #ffffff;
}
.cp_snslink03 .cp_link:hover a {
color: #80deea;
}