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


Posted in HTML / CSS onNovember 23, 2014

三水点靠木之前为大家分享了很多款纯css3实现的实用按钮。今天给大家带来一款基于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-aligncenter;   
  7.         }   
  8.            
  9.         *   
  10.         {   
  11.             -moz-box-sizing: border-box;   
  12.             box-sizing: border-box;   
  13.         }   
  14.            
  15.         .share-buttons   
  16.         {   
  17.             positionabsolute;   
  18.             width300px;   
  19.             height212px;   
  20.             padding-left135px;   
  21.             top: 50%;   
  22.             left: 50%;   
  23.             margin-left: -150px;   
  24.             margin-top: -106px;   
  25.         }   
  26.         .share-buttons .share-button   
  27.         {   
  28.             floatleft;   
  29.             margin-top15px;   
  30.         }   
  31.         .share-buttons .share-button:first-child   
  32.         {   
  33.             margin-top: 0;   
  34.         }   
  35.         .share-buttons .share-button:after   
  36.         {   
  37.             clearboth;   
  38.             display: table;   
  39.         }   
  40.            
  41.         .share-button   
  42.         {   
  43.             displayblock;   
  44.             positionrelative;   
  45.             height30px;   
  46.         }   
  47.         .share-button:hover   
  48.         {   
  49.             cursorpointer;   
  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.             positionabsolute;   
  64.             background#fff;   
  65.             width30px;   
  66.             height30px;   
  67.             border-radius: 15px;   
  68.             left: 0;   
  69.             top: 50%;   
  70.             margin-top: -15px;   
  71.         }   
  72.            
  73.         .share-button-icon  
  74.         {   
  75.             displayblock;   
  76.             color#242424;   
  77.             positionabsolute;   
  78.             width30px;   
  79.             line-height30px;   
  80.             font-size16px;   
  81.             margin-top1px;   
  82.         }   
  83.            
  84.         .share-button-secondary   
  85.         {   
  86.             overflowhidden;   
  87.             margin-left15px;   
  88.             height30px;   
  89.         }   
  90.            
  91.         .share-button-secondary-content  
  92.         {   
  93.             font-familysans-serif;   
  94.             font-size: .75em;   
  95.             background#fff;   
  96.             displayblock;   
  97.             height30px;   
  98.             text-alignleft;   
  99.             padding-left24px;   
  100.             padding-right18px;   
  101.             line-height30px;   
  102.             color#242424;   
  103.             border-radius: 0 15px 15px 0;   
  104.             -webkit-transform: translate3d(-100%, 0, 0);   
  105.             transform: translate3d(-100%, 0, 0);   
  106.             -webkit-transition: -webkit-transform 175ms ease;   
  107.             transition: transform 175ms ease;   
  108.         }  

 相关推荐:

HTML / CSS 相关文章推荐
CSS3 选择器 属性选择器介绍
Jan 21 HTML / CSS
一款纯css3实现的颜色渐变按钮的代码教程
Nov 12 HTML / CSS
CSS3绘制有活力的链接下划线
Jul 14 HTML / CSS
纯CSS3绘制打火机动画火焰效果
Jul 18 HTML / CSS
css3 实现元素弧线运动的示例代码
Apr 24 HTML / CSS
一篇文章带你学习CSS3图片边框
Nov 04 HTML / CSS
HTML5验证以及日期显示的实现详解
Jul 05 HTML / CSS
会走动的图形html5时钟示例
Apr 27 HTML / CSS
深入探究HTML5的History API
Jul 09 HTML / CSS
详解window.open被浏览器拦截的解决方案
Jul 18 HTML / CSS
详解CSS伪元素的妙用单标签之美
May 25 HTML / CSS
HTML5 语义化标签(移动端必备)
Aug 23 HTML / CSS
五款漂亮的纯CSS3动画按钮的实例教程
Nov 21 #HTML / CSS
html5+css3之动画在webapp中的应用
Nov 21 #HTML / CSS
一款恶搞头像特效的制作过程 利用css3和jquery
Nov 21 #HTML / CSS
html5+css3之CSS中的布局与Header的实现
Nov 21 #HTML / CSS
html5+css3气泡组件的实现
Nov 21 #HTML / CSS
纯css3实现的动画按钮的实例教程
Nov 17 #HTML / CSS
实列教程 一款基于jquery和css3的响应式二级导航菜单
Nov 13 #HTML / CSS
You might like
再说下636单管机
2021/03/02 无线电
php通过修改header强制图片下载的方法
2015/03/24 PHP
PHP中使用BigMap实例
2015/03/30 PHP
CodeIgniter自定义控制器MY_Controller用法分析
2016/01/20 PHP
ThinkPHP实现静态缓存和动态缓存示例代码
2017/05/02 PHP
laravel框架中表单请求类型和CSRF防护实例分析
2019/11/23 PHP
thinkphp中常用的系统常量和系统变量
2014/03/05 Javascript
JQuery的Ajax中Post方法传递中文出现乱码的解决方法
2014/10/21 Javascript
javascript如何操作HTML下拉列表标签
2015/08/20 Javascript
轻松学习jQuery插件EasyUI EasyUI创建树形网络(1)
2015/11/30 Javascript
nodejs修复ipa处理过的png图片
2016/02/17 NodeJs
JavaScript中的事件委托及好处
2016/07/12 Javascript
JS搜狐面试题分析
2016/12/16 Javascript
使用Angular缓存父页面数据的方法
2017/01/03 Javascript
MUI 解决动态列表页图片懒加载再次加载不成功的bug问题
2017/04/13 Javascript
一个可复用的vue分页组件
2017/05/15 Javascript
Vue组件实例间的直接访问实现代码
2017/08/20 Javascript
浅谈react 同构之样式直出
2017/11/07 Javascript
详解tween.js 中文使用指南
2018/01/05 Javascript
Vue iview-admin框架二级菜单改为三级菜单的方法
2018/07/03 Javascript
layui动态渲染生成select的option值方法
2019/09/23 Javascript
解决vue+ element ui 表单验证有值但验证失败问题
2020/01/16 Javascript
[55:56]NB vs Infamous 2019国际邀请赛淘汰赛 败者组 BO3 第二场 8.22
2019/09/05 DOTA
python 从文件夹抽取图片另存的方法
2018/12/04 Python
Python数据可视化实现漏斗图过程图解
2020/07/20 Python
使用css3和jquery实现可伸缩搜索框
2014/02/12 HTML / CSS
纯css实现照片墙3D效果的示例代码
2017/11/13 HTML / CSS
Staples英国官方网站:办公用品一站式采购
2017/10/06 全球购物
什么是TCP/IP
2014/07/27 面试题
幼儿园中班新学期寄语
2014/01/18 职场文书
房屋租赁合同补充协议
2014/10/11 职场文书
公司行政助理岗位职责
2015/04/11 职场文书
2015年仓库管理员工作总结
2015/04/21 职场文书
运动员入场词
2015/07/18 职场文书
react 项目中引入图片的几种方式
2021/06/02 Javascript
Mysql数据库按时间点恢复实战记录
2021/06/30 MySQL