CSS 05 transition特效
2023-03-07 09:11:04 时间
transition-property 过渡属性,默认值为all
transition-duration 过渡持续时间,默认时间为0s
transition-timing-function 过渡函数,默认ease函数,还有ease-out(先快后慢)、ease-in(先慢后快)、linear(匀速)等等函数
transition-delay 过渡延迟时间,默认0s
.ceng{
width:100px;
height:100px;
background-color:pink;
cursor:pointer;
transition-duration:2s;
transition-property:height; //指定方向,默认all,即所有方向都变化
transition-delay:.1s;
transition-timing-function:ease;
transition:all 2s .1s ease; //transition 的复合写法
} .ceng:hover{
width:300px;
height:150px;
background-color:red;
/ border-radius:50%;/ //圆形也可以变化,正方形变成圆形
} 仿天猫专题过渡效果实例
手机馆
<div class='m_content'>
R9s Plus最新上线
</div>
<div class="m_img">
<img src="./r9s,jpg" alt="手机">
</div>
</li>
</ul>
*{
padding:0px;
margin:0px;
front-family:'Microshoft YaHei';
} .main{
margin:10px auto;
width:230px;
border:1px solid #ccc;
text-align:center;
} .main li{
list-style:none;
cursor:pointer; //鼠标三角形状变成手形
} .m_title{
front-size:20px;
font-weight:bold;
margin:5px;
} m.content{
color:#666;
margin-bottom:15px;
} .m_img{
position:relative;
padding:30px;
} .m_img::before{ //伪元素
content:"";
position:absolute;
width:160px;
height:160px;
background-color:#eee;
border-radius:50%;
z-index:-1;
left:35px;
top:10px;
} .m_img img{
transform:scale(1);
transition:all .5s;
} .main li:hover .m_img img{
transform:scale(1);
} 仿天猫首页类别展示的效果
好车特卖一口价
<div class="m_content">
新车 新年 开回家
</div>
<div class="m_img">
<img src="./car.jpg" alt="新车特卖">
</div>
.main{
width:260px;
height:270px;
border:1px; solid #ccc;
margin:50px auto;
front-family:'Microshoft YaHei';
cursor:pointer;
} .m_title{
text-align:left;
font-size:20px;
padding:20px 10px 10px 10px;
} .m_content{
color:#11ccaa;
padding:0 10px 10px 10px;
} .m_img{
text-align:right;
position:relative; //相对定位
} .m_img img{
position:absolute; //绝对定位
width:180px;
top:0px;
right:0px;
teansition:right 0.3s;
} .mail:hover img{
right:10px;
}
相关文章
- 在 Go 里用 CGO?这 7 个问题你要关注!
- 9款优秀的去中心化通讯软件 Matrix 的客户端
- 求职数据分析,项目经验该怎么写
- 在OKR中,我看到了数据驱动业务的未来
- 火山引擎云原生大数据在金融行业的实践
- OpenHarmony富设备移植指南(二)—从postmarketOS获取移植资源
- 《数据成熟度指数》报告:64%的企业领袖认为大多数员工“不懂数据”
- OpenHarmony 小型系统兼容性测试指南
- 肯睿中国(Cloudera):2023年企业数字战略三大趋势预测
- 适用于 Linux 的十大命令行游戏
- GNOME 截图工具的新旧截图方式
- System76 即将推出的 COSMIC 桌面正在酝酿大变化
- 2GB 内存 8GB 存储即可流畅运行,Windows 11 极致精简版系统 Tiny11 发布
- 迎接 ecode:一个即将推出的具有全新图形用户界面框架的现代、轻量级代码编辑器
- loongarch架构介绍(三)—地址翻译
- Go 语言怎么解决编译器错误“err is shadowed during return”?
- 敏捷:可能被开发人员遗忘的部分
- Denodo预测2023年数据管理和分析的未来
- 利用数据推动可持续发展
- 在 Vue3 中实现 React 原生 Hooks(useState、useEffect),深入理解 React Hooks 的