<div class="contents">text</div>
<ul class="cp_snslink04">
<li class="cp_link facebook"><a href="#"><span>Facebook</span></a></li>
<li class="cp_link twitter"><a href="#"><span>Twitter</span></a></li>
<li class="cp_link instagram"><a href="#"><span>instagram</span></a></li>
</ul>
body {
/*設置する親要素ページ全体ならbodyなど*/
position: relative;
height: 100vh;
margin: 0;
padding: 0;
}
.contents {
/*サンプルはfixedの確認のためにheight指定しています。*/
height: 2000px;
}
/*SNSリンクブロックの位置設定*/
.cp_snslink04 {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
display: inline-block;
margin: 0;
padding: 0;
list-style-type: none;
}
/*それぞれのSNS iconの設定*/
.cp_snslink04 .cp_link {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 35px;
height: 40px;
color: #ffffff;
background: #fc787f;
border-bottom: 1px solid #ffffff;
cursor: pointer;
}
.cp_snslink04 .cp_link::before {
position: absolute;
content: '';
display: block;
width: 1em;
height: 1em;
background-size: contain;
background-repeat: no-repeat;
color: #ffffff;
}
.cp_snslink04 .cp_link:last-of-type {
border-bottom: none;
}
/*facebook*/
.cp_snslink04 .cp_link.facebook::before {
background-image: url(facebook_logo_secondary.svg);
}
/*twitter*/
.cp_snslink04 .cp_link.twitter::before {
background-image: url(x-logo.svg);
}
/*instagram*/
.cp_snslink04 .cp_link.instagram::before {
background-image: url(instagram_glyph_white.svg);
}
/*hoverで表示されるブロックの設定*/
.cp_snslink04 .cp_link span {
position: absolute;
display: flex;
align-items: center;
top: 5px;
left: -25px;/*スタート位置*/
display: flex;
align-items: center;
width: fit-content;
height: 30px;
padding: 0 10px;
opacity: 0;
color: #ffffff;
border-radius: 2px;
transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);/*飛び出す動きを設定*/
}
.cp_snslink04 .cp_link span::after{
position: absolute;
content: '';
left: -15px;
width: 15px;
height: 10px;
background: #0866ff;
clip-path: polygon(100% 0, 50% 50%, 100% 100%);
}
/*飛び出した後の位置*/
.cp_snslink04 .cp_link:hover span {
left: 45px;
opacity: 1;
}
/* facebook */
.cp_snslink04 .cp_link.facebook span,
.cp_snslink04 .cp_link.facebook span::after,
.cp_snslink04 .cp_link.facebook:hover,
.cp_snslink04 .cp_link.facebook:hover span {
background: #0866ff;
}
/* twitter */
.cp_snslink04 .cp_link.twitter span,
.cp_snslink04 .cp_link.twitter span::after,
.cp_snslink04 .cp_link.twitter:hover,
.cp_snslink04 .cp_link.twitter:hover span {
background: #000000;
}
/* instagram */
.cp_snslink04 .cp_link.instagram span,
.cp_snslink04 .cp_link.instagram:hover,
.cp_snslink04 .cp_link.instagram:hover span {
background: linear-gradient(45deg, #FF7A00 0%, #FF0169 50.06%, #D300C5 99.36%);
}
.cp_snslink04 .cp_link.instagram span::after {
background: #FF7A00;
}