博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CSS3 Transitions属性打造动画的下载按钮特效
阅读量:6275 次
发布时间:2019-06-22

本文共 5141 字,大约阅读时间需要 17 分钟。

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

 

   

 

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

html代码:

CSS3 Animated Download Buttons

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; }}
View Code

注:本文原创文章,转载请注明原文地址:

你可能感兴趣的文章
sbt笔记一 hello-sbt
查看>>
常用链接
查看>>
pitfall override private method
查看>>
!important 和 * ----hack
查看>>
聊天界面图文混排
查看>>
控件的拖动
查看>>
svn eclipse unable to load default svn client的解决办法
查看>>
Android.mk 文件语法详解
查看>>
QT liunx 工具下载
查看>>
内核源码树
查看>>
Java 5 特性 Instrumentation 实践
查看>>
AppScan使用
查看>>
Java NIO框架Netty教程(三) 字符串消息收发(转)
查看>>
Ucenter 会员同步登录通讯原理
查看>>
php--------获取当前时间、时间戳
查看>>
Spring MVC中文文档翻译发布
查看>>
docker centos环境部署tomcat
查看>>
JavaScript 基础(九): 条件 语句
查看>>
Linux系统固定IP配置
查看>>
配置Quartz
查看>>