我不明白为什么此容器的height
(summaryBox
)未更改。我试图设置min-height
,max-height
和改变一些其他的东西,但没有任何工作。我希望容器的height
是屏幕的20%,但它不工作。其他一切正常,我正在挠头。更改Div高度参数对尺寸没有任何影响
CSS:
.summaryBox {
border: 1px solid green ;
width: 80%;
margin: auto;
overflow: hidden;
min-height: 20%;
}
.summaryBox .img1 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .img2 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .sum1 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .sum2 {
width: 21%;
float: left;
color: white;
padding: 0px .5% 0px .5%;
}
.summaryBox .arrowPanelLeft {
float: left;
width: 6%;
color: white;
text-align: center;
}
.summaryBox .arrowPanelRight {
float: right;
width: 6%;
color: white;
text-align: center;
}
HTML:
<div class="summaryBox">
<div class="arrowPanelLeft">
<p><</p>
</div>
<div class="img1">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="sum1">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="img2">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="sum2">
<p>dasfafgafdgdafgdfsgdsfgdfsgdsfg</p>
</div>
<div class="arrowPanelRight">
<p>></p>
</div>
</div>
工作感谢你,但你怎么不需要设置身体的宽度以及? – samuelk71
您应该这样做,否则元素的宽度将换行到内容。查看编辑。 – Vingtoft
好的,非常感谢。 – samuelk71