一款基于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动画之流彩文字效果+图片模糊效果+边框伸展效果实现代码合集
Aug 18 HTML / CSS
CSS3 重置iphone浏览器按钮input,select等表单元素的默认样式
Oct 11 HTML / CSS
html5+css3之动画在webapp中的应用
Nov 21 HTML / CSS
基础的CSS3弹性盒Flexbox布局使用实例
Apr 08 HTML / CSS
CSS3 新增选择器的实例
Nov 13 HTML / CSS
HTML5 用动画的表现形式装载图像
Mar 08 HTML / CSS
html5使用Canvas绘图的使用方法
Nov 21 HTML / CSS
html5使用html2canvas实现浏览器截图的示例
Aug 31 HTML / CSS
Canvas 文字碰撞检测并抽稀的方法
May 27 HTML / CSS
HTML5之WebGL 3D概述(上)—WebGL原生开发开启网页3D渲染新时代
Jan 31 HTML / CSS
html标签之Object和EMBED标签详解
Jul 04 HTML / CSS
用CSS3画一个爱心
Apr 27 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
php实现的日历程序
2015/06/18 PHP
php打包网站并在线压缩为zip
2016/02/13 PHP
Laravel 中使用 Vue.js 实现基于 Ajax 的表单提交错误验证操作
2017/06/30 PHP
PHP与JavaScript针对Cookie的读写、交互操作方法详解
2017/08/07 PHP
Laravel 5.4向IoC容器中添加自定义类的方法示例
2017/08/15 PHP
php适配器模式简单应用示例
2019/10/23 PHP
30个最佳jQuery Lightbox效果插件分享
2011/04/11 Javascript
解决Extjs上传图片无法预览的解决方法
2012/03/22 Javascript
当json键为数字时的取值方法解析
2013/11/15 Javascript
通过pjax实现无刷新翻页(兼容新版jquery)
2014/01/31 Javascript
JavaScript自定义等待wait函数实例分析
2015/03/23 Javascript
js实现横向伸展开的二级导航菜单代码
2015/08/28 Javascript
微信小程序 教程之WXML
2016/10/18 Javascript
bootstrap导航栏、下拉菜单、表单的简单应用实例解析
2017/01/06 Javascript
js实现简易聊天对话框
2017/08/17 Javascript
基于vue组件实现猜数字游戏
2020/05/28 Javascript
cnpm加速Angular项目创建的方法
2018/09/07 Javascript
在Django的form中使用CSS进行设计的方法
2015/07/18 Python
解析Python中while true的使用
2015/10/13 Python
python如何使用正则表达式的前向、后向搜索及前向搜索否定模式详解
2017/11/08 Python
python实现共轭梯度法
2019/07/03 Python
简单分析python的类变量、实例变量
2019/08/23 Python
使用Python刷淘宝喵币(低阶入门版)
2019/10/30 Python
django 取消csrf限制的实例
2020/03/13 Python
html5教程画矩形代码分享
2013/12/04 HTML / CSS
Traffic People官网:女式花裙、上衣和连身裤
2020/10/12 全球购物
廉政教育心得体会
2014/01/01 职场文书
珍珠奶茶店创业计划书
2014/01/11 职场文书
党章培训心得体会
2014/09/04 职场文书
中国文明网向国旗敬礼寄语大全
2014/09/27 职场文书
乡镇群众路线教育实践活动整改措施
2014/10/04 职场文书
乡镇党员群众路线教育实践活动对照检查材料思想汇报
2014/10/05 职场文书
优秀大学生事迹材料
2014/12/24 职场文书
研究生论文答辩开场白
2015/05/27 职场文书
2019西餐厅创业计划书范文!
2019/07/12 职场文书
深入理解Pytorch微调torchvision模型
2021/11/11 Python