2021-09-18

浮动

HTML

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/浮动.css"/>
	</head>
	<body>
		<!-- bigbox外部大盒子 -->
		<div class="bigBox">
		<!-- 左边红色盒子 -->
			<div class="bigbox1">盒子一</div>
			<!-- 中间橙色绿色两个小盒子外边的大盒子 -->
			<div class="bigbox2">
			<div class="box2">盒子二</div>
			<div class="box3">盒子三</div>
			</div>
			<!-- 右边黄色蓝色两个小盒子外边的大盒子 -->
			<div class="bigbox3">
			<div class="box4">盒子四</div>
			<div class="box5">盒子五</div>
			</div>
		</div>
		
	</body>
</html>

CSS

/* 外部大盒子 */
	.bigBox {
		width: 608px;
		height: 308px;
	}

	/* 左边红色盒子 */
	.bigbox1 {
		background-color: red;
		width: 200px;
		height: 300px;
		float: left;
	}

	/* 中间包裹橙色绿色两个小盒子的盒子 */
	.bigbox2 {
		width: 400px;
		height: 150px;
		float: left;
	}

	/* 右边包裹黄色蓝色小盒子外边的大盒子 */
	.bigbox3 {
		width: 400px;
		height: 150px;
		float: left;
	}

	/* 橙色盒子 */
	.box2 {
		background-color: orange;
		width: 200px;
		height: 150px;
		float: left;
	}

	/* 黄色盒子 */
	.box3 {
		background-color: yellow;
		width: 200px;
		height: 150px;
		float: left;
	}

	/* 绿色盒子 */
	.box4 {
		background-color: green;
		width: 200px;
		height: 150px;
		float: left;
	}

	/* 蓝色盒子 */
	.box5 {
		background-color: blue;
		width: 200px;
		height: 150px;
		float: left;
	}

效果图

在这里插入图片描述

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值