CSS3 Transitions属性打造动画的下载按钮特效

一个网站的下载按钮应尽量吸引读者的注意。 这意味着网页设计师应该非常重视文件的下载界面。一个页面这么多的文件,如图片,视频和插件可以通过直接HTTP下载共享。许多免费网站甚至发布图标集和PSD文件供用户免费下载。在这些元素很多的网页下载按钮非常重要。下面就给大家带来一款动画的下载按钮,效果图如下:

在线预览   源码下载

这里不需要任何JavaScript。我们需要的是引用一个外部的样式文件styles.css。这里所有的CSS文件和index.html文件在同一目录下面。

html代码:

 <div id="wrapper">
        <h1>
            CSS3 Animated Download Buttons</h1>
        <div class="center">
            <a target=_blank href="http://www.w2bc.com/shili" class="dlbtn">Download<span class="details">.zip<span
                class="size">11.5 MB</span></span></a></div>
        <br>
        <br>
        <div class="centerbig">
            <a target=_blank href="http://www.w2bc.com/shili" class="dlbtn big">Download<span class="details"><span
                class="dlicon"><i class="entypo"></i></span>.zip<span class="size">11.5 MB</span></span></a></div>
</div>

css代码:

@font-face {
  font-family: ‘entypo‘;
  src: url(‘entypo/entypo.eot‘);
  src: url(‘entypo/entypo.eot?#iefix‘) format(‘embedded-opentype‘),
       url(‘entypo/entypo.woff‘) format(‘woff‘),
       url(‘entypo/entypo.ttf‘)  format(‘truetype‘),
       url(‘entypo/entypo.svg#svgFontName‘) format(‘svg‘);
}

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
  outline: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}
html { overflow-y: scroll; }
body {
  font-family: ‘Helvetica‘, Arial, sans-serif;
  font-size: 62.5%;
  line-height: 1;
  color: #414141;
  margin: 45px 15px;
  background: #ececec url(‘bg.png‘);
}

br { display: block; margin: 10px 0;} 

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
ol, ul { list-style: none; }

input, textarea {
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  outline: none;
}

blockquote, q { quotes: none; }
blockquote:before, blockquote:after, q:before, q:after { content: ‘‘; content: none; }
strong, b { font-weight: bold; }
em, i { font-style: italic; }

table { border-collapse: collapse; border-spacing: 0; }
img { border: 0; max-width: 100%; height: auto; width: 100%; }

h1 {
  font-size: 3.1em;
  line-height: 1.55em;
  text-align: center;
  font-weight: bold;
  font-family: ‘Oswald‘, ‘Helvetica‘, Arial, sans-serif;
  margin-bottom: 35px;
  color: #595959;
}

.entypo {
  font-family: ‘entypo‘, sans-serif;
}

/** page structure **/
#wrapper {
  display: block;
  max-width: 850px;
  padding: 45px 35px;
  margin: 0 auto;
  background: #fff;
  -webkit-border-radius: 7px;
  -moz-border-radius: 7px;
  border-radius: 7px;
}

.center {
  width: 20%;
  margin: 0 auto;
}
.centerbig {
  width: 40%;
  margin: 0 auto;
}

/** download button effect **/
a.dlbtn {
  display: inline-block;
  position: relative;
  height: 45px;
  line-height: 40px;
  overflow: hidden;
  padding: 0 30px;
  font-size: 12px;
  font-weight: bold;
  color: #c0c0c0;
  background-color: #fff;
  text-decoration: none;
  cursor: pointer;
  border: 3px solid #ddd;
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  border-radius: 2px;
  -webkit-transition: all 0.4s;
  -moz-transition: all 0.4s;
  transition: all 0.4s;
}

a.dlbtn:hover, a.dlbtn:focus {
  color: #fff;
  padding-right: 90px;
  background-color: #5381bf;
  border-color: #5381bf;
}

a.dlbtn .details {
  position: absolute;
  line-height: 11px;
  top: 4px;
  right: -15px;
  opacity: 0;
  background: #49668c;
  color: #fff;
  text-align: center;
  padding: 3px 4px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  -webkit-transition: right 0.4s linear, opacity 0.25s;
  -moz-transition: right 0.4s linear, opacity 0.25s;
  transition: right 0.4s linear, opacity 0.25s;
}
a.dlbtn .details .size {
  display: block;
  padding-top: 3px;
}

a.dlbtn:hover .details, a.dlbtn:focus .details {
  right: 8px;
  opacity: 1;
}

/** large download button **/
a.dlbtn.big {
  height: 115px;
  line-height: 115px;
  padding: 0 80px;
  font-size: 26px;
  -webkit-border-radius: 8px;
  -moz-border-radius: 8px;
  border-radius: 8px;
}
a.dlbtn.big:hover, a.dlbtn.big:focus {
  padding-right: 160px;
}

a.dlbtn.big .details {
  top: 10px;
  font-size: 18px;
  line-height: 20px;
  padding: 6px 15px;
}

a.dlbtn.big:hover .details, a.dlbtn.big:focus .details {
  right: 15px;
}

a.dlbtn .dlicon {
  display: block;
  font-size: 55px;
  line-height: 30px;
}

/** responsive styles **/
@media screen and (max-width: 620px) {
  h1 { font-size: 2.7em; }
  .center { width: 30%; }
  .centerbig { width: 70%; }
}

@media screen and (max-width: 480px) {
  h1 { font-size: 2.2em; }
  .center { margin-left: 0; }
  .centerbig { margin-left: -20px; }

  a.dlbtn.big { padding: 0 70px; }
  a.dlbtn.big:hover, a.dlbtn.big:focus { padding-right: 150px; }
}

注:本文爱编程原创文章,转载请注明原文地址:http://www.w2bc.com/Article/6364

时间: 2024-08-10 00:03:31

CSS3 Transitions属性打造动画的下载按钮特效的相关文章

使用CSS3 BACKFACE-VISIBILITY属性制作翻转动画效果

摘要: 通过backface-visibility:hidden;属性,我们可以使一个元素在翻转之后消失,这是可以使用另一个元素放在它的背面,从而制作出一种元素翻转之后出现另一个元素的效果. ... 使用CSS3 backface-visibility属性我们可以制作出许多有趣的动画效果.当你翻转一个元素的时候,你看到的是什么?通常情况下,我们应该看到的是元素的背面,这是正常的情况,但是有时候我们希望翻转一个元素后看到的是另一个元素. 查看演示  插件下载 使用CSS3 backface-vis

CSS3和js炫酷点击按钮3D翻转动画特效

简要教程 flipside是一款使用CSS3和js制作的炫酷点击按钮无缝过渡到确认面板的过渡动画特效.该点击按钮特效在按钮不同方向的边部点击时,产生的过渡动画特效是不一样的. 在线预览   源码下载 使用方法 使用该按钮过渡动画特效需要引入它提供的按钮样式表style.css和用于触发按钮点击事件的js文件script.js. HTML结构 该点击按钮过渡动画特效使用一个嵌套div的HTML结构: <div class="btn"> <div class="

使用CSS3各个属性实现小人的动画

使用CSS3各个属性实现带有音乐小人的动画,完全不使用JS代码: 注:chrome浏览器效果最佳,最终效果静态图: HTML代码如下: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8";> <title>练习一个小人的动画</title> <lin

精选12个时尚的 CSS3 效果【附源码下载】

精选12个时尚的 CSS3 效果[附源码下载] 这里是精选的12个很炫的 CSS3 效果.CSS3 是对 CSS 规范的一个很大的改善和增强,它使得 Web 开发人员可以很容易的在网站中加入时尚的效果.以前很多需要编写复杂的 JavaScript 代码才能实现的效果,如今只需要简单的写几句 CSS3 代码就能实现. 超炫的 CSS3 页面切换动画效果 今天我们想与大家分享一组创意的页面切换熊效果集合.我们已经在示例中罗列了一组动画,可以被应用到页面切换过程中,创造出很有趣的导航效果. 源码下载 

CSS3 Transitions, Transforms和Animation使用简介与应用展示

by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=1268 一.前言兼目录索引 <天龙八部>里的虚竹小和尚之前可以说是和尚的先进人物与代表模范,各类清规戒律谨记与严守.但是,后来呢,花姑娘送到跟前,什么戒律都成了浮云,禁不住诱惑享乐去了.啊,我现在似乎有类似的感觉,本来不打算深究CSS3的一些属性的,但是其效果以及实际应用价值之诱惑实在巨大,还是抵挡不住,折腾下了这篇文

让你心动的 HTML5 &amp; CSS3 效果【附源码下载】

这里集合的这组 HTML5 & CSS3 效果,有的是网站开发中常用的.实用的功能,有的是先进的 Web 技术的应用演示.不管哪一种,这些案例中的技术都值得我们去探究和学习. 超炫的 HTML5 粒子效果进度条 我喜欢粒子效果作品,特别是那些能够应用于实际的,例如这个由 Jack Rugile 基于 HTML5 Cavnas 编写的进度条效果.看着这么炫的 Loading 效果,即使让我多等一会也无妨:) 源码下载      在线演示 使用 CSS3 打造一组质感细腻丝滑的按钮 CSS3 引入了

纯CSS3实现牛奶般剔透的3D按钮特效

今天我们要来看一款非常特别的纯CSS3 3D按钮,它的外观酷似纯白剔透的牛奶,点击按钮的时候还会出现一种很柔和的弹力效果.按钮按下时,按钮会轻轻的弹动一下,非常逼真.本文我们在观赏演示的同时,也将源代码分享出来一起学习. 你也可以在这里查看在线演示 接下来我们来分析一下实现这款CSS3 3D按钮的步骤及其代码,总体而言,这款CSS3 3D按钮主要由HTML代码和CSS代码组成.实现原理是用两个span来替代checkbox选中和不选中两个状态的样式. HTML代码: <div> <div

ios开发-UI基础-应用管理(单纯界面)改进5-使用代理实现监听下载按钮的点击(delegate)

[注意]转载时请注明出处博客园-吃唐僧肉的小悟空http://www.cnblogs.com/hukezhu/ 前几篇文章介绍了一个应用管理的小应用,从最开始的单纯实现功能,一步一步就行改进\封装,上篇文章是使用xib进行了优化,本篇文章使用代理实现监听下载按钮的点击. 在原来的基础上,使用代理的主要思路分析: 首先要新建一个协议 声明协议的要实现的方法(一般为optional) 声明一个遵守该协议的代理的属性 使用代理,通知其代理完成操作 在代理中的实现步骤: 遵守协议 设置代理(一般通过拖线

css3 实现逐帧动画

实现逐帧动画需要使用到的是Animation动画,该CSS3的Animation有八个属性:分别是如下:1: animation-name2: animation-duration3: animation-delay4: animation-iteration-count5: animation-direction6: animation-play-state7: animation-fill-mode8: animation-timing-function 含义分别如下:animation-n