侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

一款基于css3的动画按钮代码教程

前端  /  管理员 发布于 7年前   168

  AIDI之前为大家分享了很多款纯css3实现的实用按钮。今天给大家带来一款基于css3的动画按钮。实现的效果图如下:

  实现的代码。

  html代码:

XML/HTML Code复制内容到剪贴板
  1. <div class="share-buttons">  
  2.         <div class="share-button">  
  3.             <div class="share-button-secondary">  
  4.                 <div class="share-button-secondary-content">  
  5.                     share on twitter   
  6.                 </div>  
  7.             </div>  
  8.             <div class="share-button-primary">  
  9.                 <i class="share-button-icon fa fa-twitter"></i>  
  10.             </div>  
  11.         </div>  
  12.         <div class="share-button">  
  13.             <div class="share-button-secondary">  
  14.                 <div class="share-button-secondary-content">  
  15.                     share on facebook   
  16.                 </div>  
  17.             </div>  
  18.             <div class="share-button-primary">  
  19.                 <i class="share-button-icon fa fa-facebook"></i>  
  20.             </div>  
  21.         </div>  
  22.         <div class="share-button">  
  23.             <div class="share-button-secondary">  
  24.                 <div class="share-button-secondary-content">  
  25.                     pin on pinterest   
  26.                 </div>  
  27.             </div>  
  28.             <div class="share-button-primary">  
  29.                 <i class="share-button-icon fa fa-pinterest"></i>  
  30.             </div>  
  31.         </div>  
  32.         <div class="share-button">  
  33.             <div class="share-button-secondary">  
  34.                 <div class="share-button-secondary-content">  
  35.                     share on tumblr   
  36.                 </div>  
  37.             </div>  
  38.             <div class="share-button-primary">  
  39.                 <i class="share-button-icon fa fa-tumblr"></i>  
  40.             </div>  
  41.         </div>  
  42.         <div class="share-button">  
  43.             <div class="share-button-secondary">  
  44.                 <div class="share-button-secondary-content">  
  45.                     share on google+   
  46.                 </div>  
  47.             </div>  
  48.             <div class="share-button-primary">  
  49.                 <i class="share-button-icon fa fa-google-plus"></i>  
  50.             </div>  
  51.         </div>  
  52.     </div>  

  css3代码:

CSS Code复制内容到剪贴板
  1. body   
  2.         {   
  3.             background: -webkit-linear-gradient(0deg, #FF8008 10%, #FFC837 90%);   
  4.             background: linear-gradient(90deg, #FF8008 10%, #FFC837 90%);   
  5.             padding: 2em;   
  6.             text-align: center;   
  7.         }   
  8.            
  9.         *   
  10.         {   
  11.             -moz-box-sizing: border-box;   
  12.             box-sizing: border-box;   
  13.         }   
  14.            
  15.         .share-buttons   
  16.         {   
  17.             position: absolute;   
  18.             width: 300px;   
  19.             height: 212px;   
  20.             padding-left: 135px;   
  21.             top: 50%;   
  22.             left: 50%;   
  23.             margin-left: -150px;   
  24.             margin-top: -106px;   
  25.         }   
  26.         .share-buttons .share-button   
  27.         {   
  28.             float: left;   
  29.             margin-top: 15px;   
  30.         }   
  31.         .share-buttons .share-button:first-child   
  32.         {   
  33.             margin-top: 0;   
  34.         }   
  35.         .share-buttons .share-button:after   
  36.         {   
  37.             clear: both;   
  38.             display: table;   
  39.         }   
  40.            
  41.         .share-button   
  42.         {   
  43.             display: block;   
  44.             position: relative;   
  45.             height: 30px;   
  46.         }   
  47.         .share-button:hover   
  48.         {   
  49.             cursor: pointer;   
  50.         }   
  51.         .share-button:hover .share-button-primary   
  52.         {   
  53.             box-shadow: 1px 0 0 0 rgba(0, 0, 0, 0.1);   
  54.         }   
  55.         .share-button:hover .share-button-secondary-content  
  56.         {   
  57.             -webkit-transform: translate3d(0, 0, 0);   
  58.             transform: translate3d(0, 0, 0);   
  59.         }   
  60.            
  61.         .share-button-primary   
  62.         {   
  63.             position: absolute;   
  64.             background: #fff;   
  65.             width: 30px;   
  66.             height: 30px;   
  67.             border-radius: 15px;   
  68.             left: 0;   
  69.             top: 50%;   
  70.             margin-top: -15px;   
  71.         }   
  72.            
  73.         .share-button-icon  
  74.         {   
  75.             display: block;   
  76.             color: #242424;   
  77.             position: absolute;   
  78.             width: 30px;   
  79.             line-height: 30px;   
  80.             font-size: 16px;   
  81.             margin-top: 1px;   
  82.         }   
  83.            
  84.         .share-button-secondary   
  85.         {   
  86.             overflow: hidden;   
  87.             margin-left: 15px;   
  88.             height: 30px;   
  89.         }   
  90.            
  91.         .share-button-secondary-content  
  92.         {   
  93.             font-family: sans-serif;   
  94.             font-size: .75em;   
  95.             background: #fff;   
  96.             display: block;   
  97.             height: 30px;   
  98.             text-align: left;   
  99.             padding-left: 24px;   
  100.             padding-right: 18px;   
  101.             line-height: 30px;   
  102.             color: #242424;   
  103.             border

  • 上一条:
    CSS伪类和伪元素的区别详解
    下一条:
    五款漂亮的纯CSS3动画按钮的实例教程
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 使用 Alpine.js 排序插件对元素进行排序(0个评论)
    • 在js中使用jszip + file-saver实现批量下载OSS文件功能示例(0个评论)
    • 在vue中实现父页面按钮显示子组件中的el-dialog效果(0个评论)
    • 使用mock-server实现模拟接口对接流程步骤(0个评论)
    • vue项目打包程序实现把项目打包成一个exe可执行程序(0个评论)
    • 近期文章
    • 智能合约Solidity学习CryptoZombie第三课:组建僵尸军队(高级Solidity理论)(0个评论)
    • 智能合约Solidity学习CryptoZombie第二课:让你的僵尸猎食(0个评论)
    • 智能合约Solidity学习CryptoZombie第一课:生成一只你的僵尸(0个评论)
    • 在go中实现一个常用的先进先出的缓存淘汰算法示例代码(0个评论)
    • 在go+gin中使用"github.com/skip2/go-qrcode"实现url转二维码功能(0个评论)
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2016-10
    • 2016-11
    • 2017-06
    • 2017-07
    • 2017-08
    • 2017-09
    • 2017-10
    • 2017-11
    • 2018-03
    • 2018-04
    • 2018-05
    • 2018-06
    • 2018-09
    • 2018-11
    • 2018-12
    • 2019-02
    • 2020-03
    • 2020-04
    • 2020-05
    • 2020-06
    • 2021-04
    • 2021-05
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-10
    • 2021-11
    • 2022-08
    • 2022-09
    • 2022-10
    • 2022-11
    • 2022-12
    • 2023-01
    • 2023-02
    • 2023-03
    • 2023-04
    • 2023-05
    • 2023-06
    • 2023-07
    • 2023-09
    • 2023-10
    • 2023-11
    • 2023-12
    • 2024-01
    • 2024-02
    • 2024-03
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客