css3 2D旋转和过渡动画写法

放肆的年华 提交于 2020-02-24 05:11:06
		/*顺时针旋转45度,逆时针的话写成  -45*/
		transform: rotate(45deg);
		/*过渡动画 0.2秒*/
		transition: all 0.2s;
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		.b {
			position: relative;
			margin: auto;
			width: 200px;
			height: 100px;
			border:1px solid black;
		}
		.a {
			position: absolute;
			top:20px;
			right: 20px;
			display: block;
			height: 20px;
			width: 20px;
			border-right: 1px solid red;
			border-bottom: 1px solid red;
			/*顺时针旋转45度,形成一个下箭头*/
			transform: rotate(45deg);
			
		}
		div:hover .a {
			/*顺时针旋转225度*/
			transform: rotate(225deg);
			/*过渡动画 0.2秒*/
			transition: all 0.2s;
		}
	</style>
</head>
<body>
	<div class="a">
		<div class="b"></div>
	</div>
</body>
</html>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!