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>
相关推荐
GISer_Jing19 分钟前
[总结篇]个人网站
前端·javascript
lljss202025 分钟前
html文字红色粗体,闪烁渐变动画效果,中英文切换版本
css·html·css3
疯狂的沙粒40 分钟前
在web-view 加载的本地及远程HTML中调用uniapp的API及网页和vue页面是如何通讯的?
前端·uni-app·html
小妖66644 分钟前
html 滚动条滚动过快会留下边框线
前端·html
heroboyluck1 小时前
Svelte 核心语法详解:Vue/React 开发者如何快速上手?
前端·svelte
海的诗篇_1 小时前
前端开发面试题总结-JavaScript篇(二)
开发语言·前端·javascript·typescript
琹箐1 小时前
ant-design4.xx实现数字输入框; 某些输入法数字需要连续输入两次才显示
前端·javascript·anti-design-vue
程序员-小李1 小时前
VuePress完美整合Toast消息提示
前端·javascript·vue.js
Uyker2 小时前
从零开始制作小程序简单概述
前端·微信小程序·小程序
EndingCoder6 小时前
React从基础入门到高级实战:React 实战项目 - 项目三:实时聊天应用
前端·react.js·架构·前端框架