<div class="contents">text</div>
<ul class="cp_snslink05">
<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_snslink05 {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
display: inline-block;
margin: 0;
padding: 0;
list-style-type: none;
}
/*それぞれのSNS iconの設定*/
.cp_snslink05 .cp_link {
position: relative;
width: 35px;
height: 40px;
color: #ffffff;
background: #1a405f;
cursor: pointer;
}
.cp_snslink05 .cp_link:first-of-type {
border-radius: 0 5px 0 0;
}
.cp_snslink05 .cp_link:last-of-type {
border-radius: 0 0 5px 0;
}
.cp_snslink05 .cp_link::before {
position: absolute;
content: '';
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: block;
width: 1em;
height: 1em;
background-size: contain;
background-repeat: no-repeat;
color: #ffffff;
}
.cp_snslink05 .cp_link:last-of-type {
border-bottom: none;
}
/*facebook*/
.cp_snslink05 .cp_link.facebook::before {
background-image: url(facebook_logo_secondary.svg);
}
/*twitter*/
.cp_snslink05 .cp_link.twitter::before {
background-image: url(x-logo.svg);
}
/*instagram*/
.cp_snslink05 .cp_link.instagram::before {
background-image: url(instagram_glyph_white.svg);
}
/*hoverで表示されるブロックの設定*/
.cp_snslink05 .cp_link span {
position: absolute;
top: 5px;
left: 45px;
display: flex;
align-items: center;
width: fit-content;
height: 30px;
padding: 0 10px;
opacity: 0;
color: #ffffff;
background: #1a405f;
border-radius: 2px;
transition: all 0.5s ease 0.3ms;/*hover時の動きを設定*/
}
.cp_snslink05 .cp_link:hover span {
left: 45px;
opacity: 1;
}
.cp_snslink05 .cp_link span::after{/*吹き出しの三角の設定*/
position: absolute;
content: '';
top: 50%;
left: -15px;
transform: translateY(-50%);
width: 15px;
height: 10px;
background: #1a405f;
clip-path: polygon(100% 0, 50% 50%, 100% 100%);
}
/* facebook */
.cp_snslink05 .cp_link.facebook:hover {
background: #0866ff;
}
/* twitter */
.cp_snslink05 .cp_link.twitter:hover {
background: #000000;
}
/* instagram */
.cp_snslink05 .cp_link.instagram:hover {
background: linear-gradient(45deg, #FF7A00 0%, #FF0169 50.06%, #D300C5 99.36%);
}