61,112
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<style type="text/css">
div{
border:1px dashed red;
background-color:#ccc;
width:100px;
height:100px;
}
div.myfloat{
float:left
}
</style>
</head>
<body>
<div class="myfloat">div#1</div>
<div>div#2</div>
<div>div#3</div>
<div>div#4</div>
</body>
</html>
<html>
<head>
<style type="text/css">
div.hello{
background:#003366;
color:#fff;
}
div.myfloat{
float:left;
border:1px dashed red;
background-color:#ccc;
width:100px;
height:100px;
overflow:hide;
margin-left:10px;
}
</style>
</head>
<body>
<div class="myfloat">div.myfloat</div>
<div class="hello">这个div穿透div.myfloat,而文字部分却没有被遮住</div>
</body>
</html>