CSS 3层嵌套居中布局

<html>
	<head>
		<style type="text/css">
			.root{
				background-color: red;
			  	width: 80%;
			  	top: 20px;
			  	position: fixed;
			  	bottom: 20px;
			  	margin-left: 10%;
			}
			.parent{
				  background-color: green;
				  position: absolute;
				  left: 20px;
				  right: 20px;
				  top: 30px;
				  bottom: 20px;
			}
			.child{
				  background-color: blue;
				  position: absolute;
				  left: 10px;
				  right: 10px;
				  top: 20px;
				  height:100px;
				  margin-top: -65px;
			}
		</style>
	</head>
	<body>
		<div class="root">
			<div class="parent">
				<div class="child">
				</div>
			</div>
		</div>
	</body>
</html>

  

posted on 2015-08-21 13:37  Admin_csq  阅读(476)  评论(0编辑  收藏  举报