<div class="contents">text contents</div>
<ul class="cp_snslink02">
<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_snslink02 {
position: fixed;
top: 50%;
left: -145px;
transform: translateY(-50%);
display: block;
margin: 0;
padding: 0;
}
/*それぞれのSNS iconの設定*/
.cp_snslink02 .cp_link {
position: relative;
left: 0;
padding: 10px 40px 10px 10px;
text-align: right;
transition: left 0.6s ease-in-out;
color: #ffffff;
cursor: pointer;
}
.cp_snslink02 .cp_link a {
color: #ffffff;
}
.cp_snslink02 .cp_link.facebook::after,
.cp_snslink02 .cp_link.twitter::after,
.cp_snslink02 .cp_link.instagram::after {
position: absolute;
content: '';
top: 50%;
right: 10px;
transform: translateY(-50%);
background-size: contain;
background-repeat: no-repeat;
width: 1em;
height: 1em;
}
/*facebook*/
.cp_snslink02 .facebook {
background: #0866ff;
}
.cp_snslink02 .cp_link.facebook::after {
background-image: url(facebook_logo_secondary.svg);
}
/*twitter*/
.cp_snslink02 .twitter {
background: #000000;
}
.cp_snslink02 .cp_link.twitter::after {
background-image: url(x-logo.svg);
}
/*instagram*/
.cp_snslink02 .instagram {
background: linear-gradient(45deg, #FF7A00 0%, #FF0169 50.06%, #D300C5 99.36%);
}
.cp_snslink02 .cp_link.instagram::after {
background-image: url(instagram_glyph_white.svg);
}
.cp_snslink02 .cp_link:hover {
left: 140px;
}
.cp_snslink02 .cp_link .nav-label {
display: inline-block;
}