CSS3: transition实例
2015-09-08 12:47
701 查看
基础理论
transition 有五个属性:property : 属性 , 可以指定哪个CSS属性进行过渡,也能使用all全部属性生效
duration : 持续时间
timing-function: 过渡函数,有linear(匀速),ease-in(渐现),ease-out(渐隐) ,ease-in-out(渐显渐隐)等。。。
delay : 是延迟 ,就是开始执行前等待的时间
综合写法:
transition: <property> <duration> <timing-function> <delay>
直接上例子 , 代码自己新建一个html保存,在chrome下或者chromium内核浏览器预览即可。。。firefox也行
LiveDemo
代码块
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>transition Demo</title> <style> /* transition: <property> <duration> <timing-function> <delay>;*/ .demobox { position: relative; left: 25%; top:300px; border-style: solid; border-width: 1px; display: block; width: 100px; height: 100px; background-color: #56A892; -webkit-transition: all 1s ease-in-out .5s; transition: all 1s ease-in-out .5s; } .demobox:hover { background-color: #fcc; width: 200px; height: 200px; border-radius: 10px; background-color: #2AA2E6; -webkit-transform: rotate(180deg) skew(-5deg,150deg) scale(.5); -ms-transform: rotate(180deg) skew(-5deg,150deg) scale(.5); transform: rotate(180deg) skew(-5deg,150deg) scale(.5); } .btn{ width:200px; height:50px; box-shadow: 2px 2px 2px rgba(38,55,64,.9); -webkit-transition: all 2s ease-in-out ; transition: all 2s ease-in-out ; } .btn:hover{ color:#F5F5F5; font-size:bolder; background: linear-gradient(-45deg, #36C783, #2A9DC8 ); box-shadow: 2px 2px 5px #ABABB4 inset; -webkit-transform: translateX(250px) translateY(100px) rotate(45deg); -ms-transform: translateX(250px) translateY(100px) rotate(45deg); transform: translateX(250px) translateY(100px) rotate(45deg); } </style> </head> <body> <p>盒子和按钮的多个属性一起动画.hover触发</p> <div class="demobox"></div> <button type="button" class="btn">啦啦啦德玛西亚</button> </body> </html>
相关文章推荐
- css3扇形菜单
- css3弹性盒子布局
- css:滑动门
- CSS温故第二天【样式】-背景 文本 字体
- grunt合并压缩js、css文件
- CSS块级元素、内联元素概念
- Grunt:多个css,js,进行单独压缩
- CSS中的浮动和定位
- grunt学习(四)——css资源的合并和压缩
- 【CSS】自适应网页设计
- CSS字体中英文名称对照表
- 置换元素(替换元素)和非置换元素(不可替换元素)
- CSS-3 新弹性盒模型属性
- 自定义进度条\文字描边样式\文字上下滚动TextSwithcher的应用
- CSS层叠样式温故第一天
- CSS3:简易的循环弹跳动画
- CSS3:简易的循环弹跳动画
- CSS样式规范
- css定位浮动 &html 严格模式混杂模式
- 一个简单div+css来练习