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>
相关推荐
菜泡泡@30 分钟前
仓库地图vue-grid-layout
前端·javascript·vue.js
u***u6852 小时前
React环境
前端·react.js·前端框架
X***E4632 小时前
前端数据分析应用
前端·数据挖掘·数据分析
4***14903 小时前
React社区
前端·react.js·前端框架
LFly_ice3 小时前
学习React-24-路由传参
前端·学习·react.js
Lhuu(重开版3 小时前
CSS:动效布局动画
前端·css
Q***K553 小时前
前端构建工具
前端
laocooon5238578864 小时前
创建了一个带悬停效果的“我的个人主页“按钮
前端
2013编程爱好者5 小时前
Vue工程结构分析
前端·javascript·vue.js·typescript·前端框架
小满zs5 小时前
Next.js第十一章(渲染基础概念)
前端