web前端全系列 教程
1839个小节阅读:2244.1k
目录
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
CSS3 过渡是元素从一种样式逐渐改变为另一种的效果
通过过渡transition
,可以让web前端开发人员不需要javascript
就可以实现简单的动画交互效果
值 | 描述 |
---|---|
transition | 简写属性,用于在一个属性中设置四个过渡属性 |
transition-property | 过渡属性:all|transition-property |
transition-duration | 定义过渡效果花费的时间,默认是0 |
transition-timing-function | 过渡效果的时间曲线:ease|ease-in|ease-out|ease-in-out |
transition-delay | 规定过渡效果何时开始,默认是0 |
xxxxxxxxxx
<div class="box"></div>
xxxxxxxxxx
.box {
width: 100px;
height: 80px;
background-color: rgba(255, 0, 0, .8);
transition: width 2s ease 1s;
}
.box:hover{
width: 500px;
}
实现小米官网动画效果
xxxxxxxxxx
<div class="box"></div>
xxxxxxxxxx
.box {
width: 200px;
height: 250px;
background-color: #8ac007;
margin: 50px;
transition: all .2s linear;
}
.box:hover{
box-shadow: 0 15px 30px rgba(0,0,0,0.2);
transform: translate3d(0,-2px,0);
}
实时效果反馈
1.过渡效果属性中,transition-duration
属性的作用是:
A 设置过渡属性
B 过渡效果花费的时间
C 过渡效果的时间曲线
D 渡效果何时开始
答案
1=>B