我有一个设置为480px高的父div。它有两个孩子,每个孩子都有动态填充AJAX的内容,所以我不知道他们最终会有多高。最上面的孩子充当标题,我需要所有的信息来显示,但是第二个孩子只有一个很长的列表,它将会溢出: auto;。有没有办法让第二个孩子只填满第一个孩子没有使用的剩余空间?
<div id = "parent">
<div id = "child1" >
<h2>Header</h2>
<p>Paragraph. I don't know ho l
我偶然发现了一些发生在我的弹性子项目上的事情,如所示。
这是代码:
<div style="position:absolute; top:10px; left:10px; background-color:yellow; height:50px; width:200px; display:flex; flex-direction:column;">
<div style="overflow:hidden;">inner div text<br>inner div text<br>inner div text
这是我的css:
html {
/* force document to be 200% of window size */
min-height: 200%;
}
body {
height:auto;
margin:0 auto;
}
div#wrapper {
/* so that child divs with floats stay contained */
overflow:hidden;
margin:auto;
min-width:200%;
min-height:200%; /* doesn't work */
background-color:#000;
bor
我向你伸出手..。
我有一个覆盖(包含两个div),应该采取的高度,它需要多少,但不大于屏幕。如果内容太大,我将需要一个滚动条,但我希望滚动条只用于第二个div的。
HTML
<div class="parent">
<div class="child1"></div>
<div class="child2">This div contains a long text, longer than there is space.</div>
</div>
CSS
.par
我有一个没有高度的父div,也嵌套了另一个子div,里面有绝对位置。Child div的高度为652px。但我不能在父div中获得相同的高度。我试着使用clear: both,overflow。
代码如下:
HTML
<div class="content">
<div class="container">
some other elements whose height is 652px...
</div>
</div>
CSS
.content {