CSS学习之清除浮动四_04

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>清除浮动四</title>
		<style>
			.clearfix:before,
			.clearfix:after{
				content: "";
				display: table;
			}
			.clearfix:after{
				clear:both;
			}
			.clearfix{
				*zoom: 1;
			}
			.one{
				width: 500px;
				background-color: pink;
				border: 1px solid red;
			}
			.damao{
				float:left;
				width: 200px;
				height: 200px;
				background-color: purple;
			}
			.ermao{
				float:left;
				width: 250px;
				height: 250px;
				background-color: skyblue;
			}
			.two{
				width: 700px;
				height: 150px;
				background-color: #000;
			}
		</style>
	</head>
	<body>
		<div class="one clearfix">
			<div class="damao"></div>
			<div class="ermao"></div>
		</div>
		<div class="two"></div>
	</body>
</html>
使用双伪类清除浮动元素

猜你喜欢

转载自blog.csdn.net/weixin_44079801/article/details/106967621