CSS布局

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>圣杯布局</title>
	<style type="text/css">
		* {
			margin: 0px;
			padding: 0px;
		}
		.container {
			padding: 0px 200px;
			height: 200px;
			background: #eee;
			min- 400px;

		}
		.left ,.right {
			 200px;
			height: 200px;
			background: red;
			float: left;
		}
		.main {

			 100%;
			height: 200px;
			background: blue;
			float: left;
		}
		.left {
			margin-left: -100%;
			position: relative;
			left:-200px;
		}
		.right {
			margin-left: -200px;
			position: relative;
			right: -200px;
		}
	</style>
</head>
<body>
	<div class="container">
		<div class="main">中间</div>
		<div class="left">左边</div>
		<div class="right">右边</div>
	</div>
</body>
</html>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>shuipingchuzhijuzhong</title> <style type="text/css"> * { margin: 0px; padding: 0px; } .box { position: relative;  200px; height: 200px; background: lightgreen; } .out { position: absolute; left: 50%; top: 50%; } .in { background: red; margin-top: -50%; margin-left: -50%; } </style> </head> <body> <div class="box"> <div class="out"> <div class="in">内容</div> </div> </div> </body> </html>
原文地址:https://www.cnblogs.com/tasly/p/11831296.html