带有社交图标的动画共享按钮

84 篇文章 0 订阅
28 篇文章 0 订阅

带有社交图标的动画共享按钮

教程地址原文地址(YouTube)

B站教程原文转载(bilibili)

两个视频的内容相同,第二个为转载

效果图

在这里插入图片描述

代码区

html

<div class="content">
  <div class="text">Animated Share Button with Icon</div>
  <p>HTML and CSS (Animation)</p>
  <input type="checkbox" id="click">
  <label for="click" class="share-btn">
    <span class="fas fa-share-alt"></span>
    <a href="#"><span class="fab fa-twitter"></span></a>
    <a href="#"><span class="fab fa-instagram"></span></a>
    <a href="#"><span class="fab fa-youtube"></span></a>
  </label>
</div>

CSS

@import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
*{
  margin: 0;
  padding: 0;
  user-select: none;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}
body{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #a7ffeb;
  text-align: center;
}
.content{
  color: #202020;
}
.text{
  font-size: 40px;
  font-weight: 600;
}
p{
  font-size: 37px;
  font-weight: 500;
}
.share-btn{
  position: absolute;
  bottom: 30px;
  right: 30px;
  z-index: 1;
}
.share-btn span{
  height: 60px;
  width: 60px;
  background: #16a085;
  line-height: 60px;
  font-size: 25px;
  color: #e9fcf8;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid #159d82;
}
.share-btn:hover span{
  background: #159d82;
  border-color: #12876f;
}
.share-btn a span{
  position: absolute;
  right: 10px;
  bottom: 10px;
  height: 30px;
  width: 30px;
  line-height: 30px;
  font-size: 18px;
  border: 1px solid transparent;
  background: #16a085;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transition: 0.6s;
}
#click:checked ~ .share-btn a span{
  height: 50px;
  width: 50px;
  line-height: 50px;
  font-size: 23px;
  z-index: 1;
  opacity: 1;
  pointer-events: auto;
}
#click:checked ~ .share-btn a:nth-child(2) span{
  bottom: 0px;
  right: 80px;
  background: #1da1f2;
  border-color: #0e9af1;
}
#click:checked ~ .share-btn a:nth-child(3) span{
  bottom: 65px;
  right: 65px;
  background: #e1306c;
  border-color: #df2060;
}
.share-btn a:nth-child(3) span{
  transition-delay: 0.2s;
}
#click:checked ~ .share-btn a:nth-child(4) span{
  bottom: 80px;
  right: 0px;
  background: #ff0000;
  border-color: #e60000;
}
.share-btn a:nth-child(4) span{
  transition-delay: 0.4s;
}
#click{
  display: none;
}

JS


教程地址原文地址(YouTube)

B站教程原文转载(bilibili)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值