CSS学习之清除浮动三_03

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>清除浮动三</title>
		<style>
			.clearfix:after {
				content: "";
				display: block;
				height: 0;
				visibility: hidden;
				clear: both;
				
			}
			.clearfix {
				*zoom: 1;
				/* ie6,7专门清除浮动的样式 */
			}
			.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>
<!-- 用clearfix的方法相当于在样式中新添加一个div,只不过该方法使用css3写出来的 -->

猜你喜欢

转载自blog.csdn.net/weixin_44079801/article/details/106967603
今日推荐