首页 > 其他 > 详细

定位的居中

时间:2020-07-09 19:06:47      阅读:49      评论:0      收藏:0      [点我收藏+]

position定位的上下左右居中

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div class="yi">
			<div class="er"></div>
		</div>
	</body>
</html>
<style>
	.yi{
		height:500px;
		width:500px;
		background:pink;
		margin:30px auto;
		position: relative;
	}
	.er{
		height:200px;
		width:200px;
		background: #008000;
		position: absolute;
		top:50%;
		left:50%;
		transform: translate(-50%, -50%);
	}
</style>

  

定位的居中

原文:https://www.cnblogs.com/xiaoyaolang/p/13275023.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!