这款CSS3动画按钮非常的有创意,鼠标在滑过按钮时并不像其他按钮那样仅仅改变按钮的背景颜色,而是出现很酷的冒泡动画。这么惊艳的CSS3动画按钮,这篇文章主要将按钮实现的过程和代码分享给大家,希望能给在学习CSS3的同学带来实质性的帮助。可以下来看看在线演示效果:

在线演示        源码下载

接下来我们来讲解一下这款CSS3气泡动画的按钮实现过程,主要由HTML代码和CSS代码组成。

HTML代码:

<div id="buttonContainer">

    <a href="#">Big Button</a>
<a href="#">Big Button</a>
<a href="#">Big Button</a>
<a href="#">Big Button</a> <a href="#">Medium Button</a>
<a href="#">Medium Button</a>
<a href="#">Medium Button</a>
<a href="#">Medium Button</a> <a href="#">Small Button</a>
<a href="#">Small Button</a>
<a href="#">Rounded</a> <a href="#">Small Button</a>
<a href="#">Small Button</a> <a href="#">Rounded</a> </div>

HTML代码相对比较简单,即用一个个a链接构造按钮,当然演示中的效果还需要CSS的大力渲染才行。

接下来的重点是CSS代码,首先我们来为每一个button渲染基础的样式,这些样式都是每一个按钮所共有的:

.button{
font:15px Calibri, Arial, sans-serif; /* A semi-transparent text shadow */
text-shadow:1px 1px 0 rgba(255,255,255,0.4); /* Overriding the default underline styling of the links */
text-decoration:none !important;
white-space:nowrap; display:inline-block;
vertical-align:baseline;
position:relative;
cursor:pointer;
padding:10px 20px; background-repeat:no-repeat; /* The following two rules are fallbacks, in case
the browser does not support multiple backgrounds. */ background-position:bottom left;
background-image:url('button_bg.png'); /* Multiple backgrounds version. The background images
are defined individually in color classes */ background-position:bottom left, top right, 0 0, 0 0;
background-clip:border-box; /* Applying a default border raidus of 8px */ -moz-border-radius:8px;
-webkit-border-radius:8px;
border-radius:8px; /* A 1px highlight inside of the button */ -moz-box-shadow:0 0 1px #fff inset;
-webkit-box-shadow:0 0 1px #fff inset;
box-shadow:0 0 1px #fff inset; /* Animating the background positions with CSS3 */
/* Currently works only in Safari/Chrome */ -webkit-transition:background-position 1s;
-moz-transition:background-position 1s;
transition:background-position 1s;
} .button:hover{ /* The first rule is a fallback, in case the browser
does not support multiple backgrounds
*/ background-position:top left;
background-position:top left, bottom right, 0 0, 0 0;
} .button:active{
/* Moving the button 1px to the bottom when clicked */
bottom:-1px;
}

同样也定义了按钮在鼠标滑过和被激活时的样式。

最后是气泡动画特效,我们拿其中一个按钮为例,代码如下:

.blue.button{
color:#0f4b6d !important; border:1px solid #84acc3 !important; /* A fallback background color */
background-color: #48b5f2; /* Specifying a version with gradients according to */ background-image: url('button_bg.png'), url('button_bg.png'),
-moz-radial-gradient( center bottom, circle,
rgba(89,208,244,1) 0,rgba(89,208,244,0) 100px),
-moz-linear-gradient(#4fbbf7, #3faeeb); background-image: url('button_bg.png'), url('button_bg.png'),
-webkit-gradient( radial, 50% 100%, 0, 50% 100%, 100,
from(rgba(89,208,244,1)), to(rgba(89,208,244,0))),
-webkit-gradient(linear, 0% 0%, 0% 100%, from(#4fbbf7), to(#3faeeb));
} .blue.button:hover{
background-color:#63c7fe; background-image: url('button_bg.png'), url('button_bg.png'),
-moz-radial-gradient( center bottom, circle,
rgba(109,217,250,1) 0,rgba(109,217,250,0) 100px),
-moz-linear-gradient(#63c7fe, #58bef7); background-image: url('button_bg.png'), url('button_bg.png'),
-webkit-gradient( radial, 50% 100%, 0, 50% 100%, 100,
from(rgba(109,217,250,1)), to(rgba(109,217,250,0))),
-webkit-gradient(linear, 0% 0%, 0% 100%, from(#63c7fe), to(#58bef7));
}

从代码中我们可以看出,当鼠标滑过按钮时,按钮中的气泡背景图片将实现渐变的动画效果,并加以一定的透明效果,这样便出现了气泡上升的动画特效。所有的代码就是这样,你可以下载源代码来研究。

在线演示        源码下载

纯CSS3冒泡动画按钮实现教程的更多相关文章

  1. 冒泡动画按钮的简单实现(使用CSS3)

    冒泡动画按钮的简单实现(使用CSS3) 原始的参考文章是 http://tutorialzine.com/2010/10/css3-animated-bubble-buttons/ ,基本原理是利用了 ...

  2. 一款基于css3的动画按钮

    之前为大家分享了 推荐10款纯css3实现的实用按钮.今天给大家带来一款基于css3的动画按钮.实现的效果图如下: 在线预览   源码下载 实现的代码. html代码: <div class=& ...

  3. 超酷!纯CSS3烧烤动画实现教程

    今天在老外的网站上看到一款很有创意的纯CSS3动画,是模拟烧烤活动的.款动画模拟了一个烧烤架,烧烤架上的食物也都是用纯CSS3绘制而成,没有用一张图片,效果相当逼真.另外一个有意思的是,这个CSS3烧 ...

  4. 纯CSS3带动画效果导航菜单

    随着互联网的发展,网页能表现的东西越来越多.由最开始单纯的文字和链接构成的网页,到后来的表格布局,再到div+css模式,现在发展到了html+css3.网页能表达的东西越来越多,css3兴起已经很多 ...

  5. 纯css3云彩动画效果

      效果描述: 纯CSS3实现的云彩动画飘动效果 非常逼真实用 使用方法: 1.将body中的代码部分拷贝到你的页面中 2.引入对应的CSS文件即可

  6. 纯css3天气动画场景特效

    CSS3超强大,以下是纯用CSS3+HTML实现的场景效果图: 查看效果:http://hovertree.com/h/bjaf/cssrotate.htm css3 3d展示中rotate()介绍与 ...

  7. 纯CSS3垂直动画菜单

    在线演示 本地下载

  8. 8个超炫酷的纯CSS3动画及源码分享

    在现代网页中,我们已经越来越习惯使用大量的CSS3元素,而现在的浏览器也基本都支持CSS3,所以很多时候我们不妨思考一下是否可以用纯CSS3制作一些有趣或者实用的网页.本文要分享8个超炫酷的纯CSS3 ...

  9. 纯CSS3超酷3D旋转立方体动画特效

    简要教程 这是一款神奇的纯 CSS3 立方体动画特效插件.使用CSS3来制作动画效果已经成为WEB前端开发的一种时尚,从简单的颜色和尺寸动画,到复杂的旋转.翻转动画, CSS3 展现了它无穷的魅力.使 ...

随机推荐

  1. Android MediaPlayer架构 -- 前言小知识点(一)

    在Android中可以使用MediaPlayer+SurfaceView来实现一个简单的多媒体播放器. 一  构造函数 java MediaPlayer class 的源码位置:frameworks\ ...

  2. Linux 标准目录结构 FHS

    因为利用 Linux 来开发产品或 distribution 的团队实在太多了,如果每个人都用自己的想法来配置文件放置的目录,那么将可能造成很多管理上的困扰.所以,后来就有了 Filesystem H ...

  3. Xcode 安装ClangFormat 插件

    sudo gem install -n /usr/local/bin update_xcode_plugins 安装ClangFormat git clone https://github.com/t ...

  4. centos清除dns cache.

    # /etc/init.d/nscd restart # service nscd restart # service nscd reload # nscd -i hosts https://www. ...

  5. Android性能优化-App启动优化

    原文地址:https://developer.android.com/topic/performance/launch-time.html#common 通常用户期望app响应和加载速度越快越好.一个 ...

  6. 原创:vsphere概念深入系列三:vSphere命令行管理

    假设无法近距离接触物理主机,只能远程命令行管理,. 以下命令行可以起到点作用. 首先需要安装vSphere CLI工具. 启动后界面: 1.查看datastore内容 所有命令行工具都可以加上-ser ...

  7. ERROR: Field * doesn't have a default value

    ERROR: Field 'status' doesn't have a default value 今天做项目,在插入数据时出现了这个从没遇到的异常,看了98%的异常分析都是针对组件id出现了类似的 ...

  8. Mysql INSERT、REPLACE、UPDATE的区别

    用于操作数据库的SQL一般分为两种,一种是查询语句,也就是我们所说的SELECT语句,另外一种就是更新语句,也叫做数据操作语句.言外之意,就是对数据进行修改.在标准的SQL中有3个语句,它们是INSE ...

  9. Apache Spark 2.2.0 正式发布

    本章内容: 待整理 参考文献: Apache Spark 2.2.0正式发布 Spark Release 2.2.0

  10. Atitit web remote远程调试的原理attilax总结

    Atitit web remote远程调试的原理attilax总结 Jvm是vm打开一个debug port,然后ide先连接..然后执行url,就会vm会与ide沟通.. Php的xdebug po ...