transition Css3过度详解
过度语法:
.example {
transition-property: background-color; //需要过度的css属性
transition-duration: 2s; //过度所需要的时间
transition-timing-function: ease-in; //过度的类型
transition-delay: 1s; //过度延迟的时间
}
大家都知道css代码是要简写的:
过渡简写:
example {
transition: background-color 2s ease-in 1s;
}
多项过度:
.example {
transition: background-color 2s ease-in 1s,
width 2s ease-in-out,
height 3s ease-out;
}
触发事件过渡:----例如 click hover 类似的事件
、背景过度,一个背景为绿色当鼠标hover时延迟1s过度到蓝色;
.example {
background-color: green;
transition: background-color 2s ease-in 1s;
}
.example:hover {
background-color: blue
}
、当用户单击并按住元素时,发生宽度属性过渡,因此该元素保持 "活动" 状态。
.example {
width: 200px;
height: 200px;
transition: width 2s ease-in;
}
.example:active {
width: 400px;
}
、当你输入元素的时候input会变宽;
input {
width: 200px;
transition: width 2s ease-in;
}
input:focus {
width: 250px;
}
、可以几个属性同时进行变化;
.example {
width: 200px;
height: 200px;
background:#;
-webkit-transition: width 2s ease,
height 2s ease, background 2s ease;
-webkit-transform: translateZ();
}
.example:hover {
width: 300px;
height: 300px;
background:green;
}
CSS代码:
[css]
#timings-demo {border: 1px solid #ccc;padding: 10px;height: 400px;width: 400px;}
.box {width: 100px;height: 50px;line-height: 50px;text-align: center;color: #fff;margin-bottom: 10px;
-webkit-border-radius: 5px;
-webkit-box-shadow: inset 5px rgba(, , ,0.5);
}
/*逐渐变慢效果:*/
#ease {background: #f36;
-webkit-transition: all 5s ease .3s;
}
/*加速效果:*/
#ease-in {background: #;
-webkit-transition: all 3s ease-in .5s;
}
/*减速效果:*/
#ease-out {background: #;
-webkit-transition: all 5s ease-out 0s;
}
/*先加速然后减速效果:*/
#ease-in-out {background: #3e6;
-webkit-transition: all 1s ease-in-out 2s;
}
/*匀速效果:*/
#linear { background: #;
-webkit-transition: all 6s linear 0s;
}
/*该值允许你去自定义一个时间曲线效果:*/
#cubic-bezier {background: #6d6;
-webkit-transition: all 4s cubic-bezier 1s;
}
/*hover状态下或单击click按钮后box产生属性变化*/
#timings-demo:hover .box {
-webkit-transform: rotate(360deg) scale(1.2);
-webkit-border-radius: 25px;
}
transition Css3过度详解的更多相关文章
- 转:【译】CSS3:clip-path详解
我的一个学生,Heather Banks,想要实现他在Squarespace看到的一个效果: 根据她的以往经验,这个网站的HTML和CSS是完全在她的能力范围以内,于是我帮助她完成了这个效果.显示na ...
- CSS3过渡详解-遁地龙卷风
第二版 0.环境准备 (1)过渡需要浏览器的支持,使用这些属性要加上浏览器厂商的前缀,我用的chrome49已经不需要前缀了, -o- Opera -webkit- Safari.Chrome -mo ...
- CSS3 transition 属性过渡效果 详解
CSS3 transition 允许 CSS 元素的属性值在一定的时间区间内平滑地过渡.我们可以在不使用 Flash 动画或 JavaScript 的情况下,在元素从一种样式变换为另一种样式时为元素添 ...
- CSS3动画详解(超详细)
本文最初发表于博客园,并在GitHub上持续更新前端的系列文章.欢迎在GitHub上关注我,一起入门和进阶前端. 以下是正文. 前言 本文主要内容: 过渡:transition 2D 转换 trans ...
- CSS3动画详解(图文教程)
本文最初发表于博客园,并在GitHub上持续更新前端的系列文章.欢迎在GitHub上关注我,一起入门和进阶前端. 以下是正文. 前言 本文主要内容: 过渡:transition 2D 转换 trans ...
- 第四十一课:CSS3 animation详解
animation是css3的另一个重要的模块,它成型比transition晚,吸取了Flash的关键帧的理念,实用性高. animation是一个复合样式,它可以细分为8个更细的样式. (1)ani ...
- CSS3属性详解(图文教程)
本文最初发表于博客园,并在GitHub上持续更新前端的系列文章.欢迎在GitHub上关注我,一起入门和进阶前端. 以下是正文. 前言 我们在上一篇文章中学习了CSS3的选择器,本文来学一下CSS3的一 ...
- CSS3动画详解(结合实例)
一.使用CSS3动画代替JS动画 JS动画频繁操作DOM导致效率非常低 在频繁的操作DOM和CSS时,浏览器会不停的执行重排(reflow)和重绘(repaint) 可以避免占用JS主线程 这边就不细 ...
- CSS3 HSL()详解:
这是CSS3新增的颜色表示模式.在CSS2中,只有RGB(red.green和blue的缩写)和十六进制两种颜色模式.为了能够支持颜色的透明度,CSS3新增了RGBA(A是Alpha缩写).但是无论是 ...
随机推荐
- 存储过程中拼接sql的示例
create or replace package body CRF_CMS_DOCTOR_PKG is --根据医院查询医生PROCEDURE P_HOSPITALBYDOCTOR_LIST ( v ...
- Windows10关闭快速启动
- 公司内部SQUID代理HTTPS访问资料网站
同事安装SQUID,我按如下方法加密: 参考URL: http://www.tuicool.com/articles/iYv2YfU 众所周知,在国内访问国外互联网经常无法访问,比如要找资料googl ...
- day03_javaEE四成结构
- Delphi 自带的 Base64 编解码函数
今天帮别人解决一个关于 Base64 编解码的问题,竟然发现 Delphi 自带了 Base64 编解码的单元,叫 EncdDecd,这名字很拗口而且不直观,估计这是一直很少人关注和知道的原因. 这个 ...
- POJ3294--Life Forms 后缀数组+二分答案 大于k个字符串的最长公共子串
Life Forms Time Limit: 500 ...
- Apache HttpClient组件封装工具类
package com.mengyao.spider.utils; import java.util.ArrayList;import java.util.HashMap;import java.ut ...
- VC CArchive类使用
CFile file("D:\\1.txt",CFile::modeCreate | CFile::modeWrite); CArchive ar(&file,CArchi ...
- C# 利用反射查看类的信息
using System; using System.Collections; using System.Collections.Generic; using System.Reflection; u ...
- structured sparsity model
Data representation往往基于如下最小化问题: (1) 其中X是观测到的数据的特征矩阵,D是字典,Z是字典上的描述.约束项和使得字典dictionary和描述code具 ...