我有一个网页,其中文本溢出容器div,即使在将height:auto;
应用于包含div之后也是如此。页面的组成如下所示:
<html>
<head>
<body>
<div id="wrapper">
<div id="inner_wrapper">
<div id="content_left">
<div class="main_content_text">
Overflowing text
</div><!--end of main_content_text-->
</div><!--end of content_left-->
<div id="content_right">
</div><!--end of content_right-->
</div><!--end of inner_wrapper-->
</div><!--end of wrapper-->
</body>
</html>
我使用的CSS看起来像这样:
#inner_wrapper{
width: 100%;
background-color: white;
min-height: 900px;
height: auto;
margin: 0px auto;
}
#content_left{
padding: 10px;
margin: 10px 10px 30px 20px;
width: 57%;
min-height: 300px;
float: left;
}
.main_content_text{
width: 625px;
height: auto;
font-weight: normal;
font-family: 'Source Sans Pro','Ubuntu Light','Ubuntu Condensed',Ubuntu,Tahoma,Arial,sans-serif;
font-size: 15px;
line-height: 20px;
margin-top: 30px;
padding-bottom: 10px;
}
我正在申请的页面是Website
答案 0 :(得分:0)
添加以下规则
#inner_wrapper:在{content:“”之后;显示:块;溢出:隐藏;明确:两者;身高:0; }
它将清除浮动,无需添加额外的<div class="clear">
元素
答案 1 :(得分:0)
为您需要的div设置overflow:auto
!