用内间距和外边距进行简单布局

148 阅读1分钟
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>布局</title>
		<style type="text/css">
			.box{
				background-color: #1dff83;
				width: 560px;
				height: 560px;
				padding-top: 40px;
				padding-left: 40px;
			}
			.box .a{
				width: 300px;
				height: 100px;
				background-color: #ff5917;
				margin-bottom: 10px;
			}
			.box .b{
				width: 120px;
				height: 200px;
				background-color: #ecff3a;
				float: left;
				margin-right: 60px;
			}
			.c{
				width: 120px;
				height: 200px;
				background-color: green;
				float: left;
				margin-bottom: 15px;
			}
			.d{
				width: 300px;
				height: 100px;
				background-color: #35ffff;
				clear: both;
				
			}
		</style>
	</head>
	<body>
		<div class="box">
			<div class="a">
			
			</div>
			<div class="b">
				
			</div>
			<div class="c">
				
			</div>
			<div class="d">
				
			</div>
		</div>
	</body>
</html>