css春夏秋冬,鼠标滑入动效展示

效果展示

图片素材

代码块

html 复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<style>
			* {
				margin: 0;
				padding: 0;
			}
			
			.box {
				width: 800px;
				height: 300px;
				display: flex;
			}
			
			.box .item {
				transition: 0.5s;
				position: relative;
			}
			
			.box .item p {
				display: flex;
				justify-content: center;
				align-items: center;
				color: #FFF;
				font-size: 60px;
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				bottom: 0;
			}
			
			.box .item img {
				width: 100%;
				height: 100%;
				object-fit: cover;
			}
			
			.box .item1 {
				flex: 1;
			}
			
			.box .item1:hover {
				flex: 5;
			}
			
			.box .item1:hover~.item2,
			.box .item1:hover~.item3,
			.box .item1:hover~.item4 {
				flex: 1;
			}
			
			.box .item2 {
				flex: 1;
			}
			
			.box .item2:hover {
				flex: 5;
			}
			
			.box .item2:hover~.item1,
			.box .item2:hover~.item3,
			.box .item2:hover~.item4 {
				flex: 1 ;
			}
			
			.box .item3 {
				flex: 1;
			}
			
			.box .item3:hover {
				flex: 5;
			}
			
			.box .item3:hover~.item1,
			.box .item3:hover~.item2,
			.box .item3:hover~.item4 {
				flex: 1;
			}
			
			.box .item4 {
				flex: 1;
			}
			
			.box .item4:hover {
				flex: 5;
			}
			
			.box .item4:hover~.item1,
			.box .item4:hover~.item2,
			.box .item4:hover~.item3 {
				flex: 1;
			}
		</style>
		<div class="box">
			<div class="item item1">
				<p>春</p>
				<img src="./img/1.jpg" alt="" />
			</div>
			<div class="item item2">
				<p>夏</p>
				<img src="./img/2.jpg" alt="" />
			</div>
			<div class="item item3">
				<p>秋</p>
				<img src="./img/3.jpg" alt="" />
			</div>
			<div class="item item4">
				<p>冬</p>
				<img src="./img/4.jpg" alt="" />
			</div>
		</div>
	</body>
</html>
相关推荐
嘟嘟071714 分钟前
前端异步编程完全指南:从json-server到DeepSeek大模型接口调用
前端
用户0595401744614 分钟前
大模型多轮对话“失忆”踩坑实录:一次线上事故让我排查了48小时,最终靠 Playwright + Pytest 把记忆锁死
前端·css
橘子星14 分钟前
前端薅数据神器 Fetch:不用翻墙,在线拿捏后端与 AI 接口
前端·后端
步步为营DotNet16 分钟前
探索.NET 11:Blazor 在跨平台客户端应用开发的进阶实践
前端·asp.net·.net
Hello馒头儿18 分钟前
vue3+uniapp经典hook方式实现一个更多加载的列表组件
前端·javascript·vue.js
浩风祭月19 分钟前
前端错误监控方案对比:Sentry SaaS vs 自部署 vs 纯开源组合
前端·openai·ai编程
ze_juejin20 分钟前
promise和try catch的比较
前端
用户5732400372321 分钟前
AgentForge-WX v0.3.0:12项更新 + 框架重新定位,把微信小程序AI对话的坑全填了
前端
米丘22 分钟前
HTTP 传输层 TCP 三次握手 / 四次挥手
前端·网络协议·http
小lan猫23 分钟前
多域 RAG 知识库:从 Vue 前端到 NestJS + PGVector 的全栈实践
前端·人工智能·typescript