一款基于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 08 HTML / CSS
用CSS3来实现社交分享按钮
Nov 11 HTML / CSS
CSS3简单实现照片墙
Dec 12 HTML / CSS
初探CSS3中的calc()功能
Jul 14 HTML / CSS
基于CSS3实现的黑色个性导航菜单效果
Sep 14 HTML / CSS
CSS3中的Media Queries学习笔记
May 23 HTML / CSS
简单聊聊H5的pushState与replaceState的用法
Apr 03 HTML / CSS
HTML5的结构和语义(3):语义性的块级元素
Oct 17 HTML / CSS
HTML里显示pdf、word、xls、ppt的方法示例
Apr 14 HTML / CSS
HTML5+CSS设置浮动却没有动反而在中间且错行的问题
May 26 HTML / CSS
如何用H5实现好玩的2048小游戏
Jul 23 HTML / CSS
html,css,javascript是怎样变成页面的
May 07 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中Date获取时间不正确怎么办
2008/06/05 PHP
php实现获取文章内容第一张图片的方法
2014/11/04 PHP
Yii2主题(Theme)用法详解
2016/07/23 PHP
PHP常用函数之根据生日计算年龄功能示例
2019/10/21 PHP
PHP7创建销毁session的实例方法
2020/02/03 PHP
html读出文本文件内容
2007/01/22 Javascript
给Javascript数组插入一条记录的代码
2007/08/30 Javascript
JavaScript中的onerror事件概述及使用
2013/04/01 Javascript
js中如何把字符串转化为对象、数组示例代码
2013/07/17 Javascript
JavaScript 垃圾回收机制分析
2013/10/10 Javascript
调试代码导致IE出错的避免方法
2014/04/04 Javascript
node.js学习总结之调式代码的方法
2014/06/25 Javascript
JS封装cookie操作函数实例(设置、读取、删除)
2015/11/17 Javascript
手机端js和html5刮刮卡效果
2020/09/29 Javascript
详解Vue-cli代理解决跨域问题
2017/09/27 Javascript
vue实现配置全局访问路径头(axios)
2019/11/01 Javascript
Python random模块(获取随机数)常用方法和使用例子
2014/05/13 Python
MySQLdb ImportError: libmysqlclient.so.18解决方法
2014/08/21 Python
python简单获取数组元素个数的方法
2015/07/13 Python
Python制作爬虫抓取美女图
2016/01/20 Python
Python标准库使用OrderedDict类的实例讲解
2019/02/14 Python
使用python判断jpeg图片的完整性实例
2019/06/10 Python
Pytorch修改ResNet模型全连接层进行直接训练实例
2019/09/10 Python
Flask框架请求钩子与request请求对象用法实例分析
2019/11/07 Python
工程业务员工作职责
2013/12/07 职场文书
会议活动邀请函
2014/01/27 职场文书
商场端午节活动方案
2014/01/29 职场文书
自立自强的名人事例
2014/02/10 职场文书
研修第一天随笔感言
2014/02/15 职场文书
学校食品安全实施方案
2014/06/14 职场文书
村干部群众路线整改措施思想汇报
2014/10/12 职场文书
2014年个人业务工作总结
2014/11/17 职场文书
事业单位年度考核个人总结
2015/02/12 职场文书
2015年消防工作总结
2015/04/24 职场文书
党小组推荐意见
2015/06/02 职场文书
小学主题班会教案
2015/08/17 职场文书