011变形之位移与缩放transform

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>京东侧边</title>
	<style>
	*{
		padding: 0;
		margin:0;
	}
	.subnav{
		margin:100px auto;
		width: 20px;
	}
	.subnav li {
		width: 20px;
		height: 20px;
		margin:3px 0px;
		background-color: pink;
		list-style: none;
		position: relative;
	}
	.subnav li div{
		z-index: -1;
		position: absolute;
		top: 0px;
		right: 0px;
		width: 0px;
		height: 20px;
		background-color:red;
		transition: all 1s;
	}
	.subnav li:hover div{
		width: 100px;

	}
	</style>
</head>
<body>
	<div class="subnav">
	<ul>
		<li><div></div></li>
		<li><div></div></li>
		<li><div></div></li>
		<li><div></div></li>
		<li><div></div></li>
	</ul>
	</div>
</body>

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_40422393/article/details/89287738