css - 设置 float 在另一个div内的div高度100%

标签 css html height css-float parent

如果一个 div 是 float 的,我如何将其设置为 100% 的父 div?

这是我得到的两种样式,其中 sidebar 是 container 的子元素 -

#container {
    width:1200px;
    margin-top:40px;
    overflow:hidden;
    text-align:center;
}
#sidebar {
    width:260px;
    float:left;
    overflow:hidden;
    height:1554px;
}

最佳答案

我会使用 Javascript 或更好的说法是 jQuery。 在这里看看:How do I keep multiple DIVs the same height using jQuery?

关于css - 设置 float 在另一个div内的div高度100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10082210/

相关文章:

css - 在 Chrome 中强制打开打印的详细信息/摘要标签

java - 如何将 xml 节点重命名为 html 标签

css - 如何使用css设计选择框

css - 为什么 text-align :center and margin:0 auto on positioned element? 没有效果看实例

html - 如何强制响应式 iframe 目标尊重 iframe 的视口(viewport)并像直接​​访问它一样做出响应?

css - 此 div 高度始终小于父 div

WPF 文本框高度等于父高度减去 50 像素?

css - float div,100% 高度

html - 我在我的代码中使用 FLEX 属性,但它不适用于 ios 7/8 设备。如何让它适用于 ios7/8?

css - 非 float 的 div 将 float 的 div 推下一行