这是一个非常简单的问题,但我似乎无法在任何地方找到如何解决这个问题的答案。有没有办法通过使用百分比使嵌套 div 成为外部 div 的 100%? div 动态插入到不同宽度的外部 div 中。现在我遇到的问题是它溢出了外部 div。当前的 css 是这样的:
.bottomDiv
{
overflow: hidden;
height: 30px;
bottom: 0px;
left: 0px;
color: red;
position: absolute;
}
div 位于外部 div 的底部。任何帮助将不胜感激!
最佳答案
你可以这样做:
<div id="outer">
<div id="inner">
</div>
</div>
用这个CSS:
#outer {
position: absolute ;
width: 50% ;
height: 50% ;
}
#inner {
position: absolute ;
bottom: 0% ;
width: 100% ;
height: 10% ;
}
关于html - 使内部 div 为外部的 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12130616/