html - 使 div 占用所有剩余空间

标签 html css

我发现有几个帖子有类似的问题,但没有很好的答案。 我在一个具有 display: table-row 属性的 div 中有两个 div。 我右边的 div 需要固定为:200px,左边的必须占用剩余空间。

CSS: 

.dhPictureDiv{
float:left;
height:100%;
background-color:red;}

.dhInfoWrapper{
width:200px;
float:right;
background-color:yellow;
border: 0px solid red;}

.dhDivRow {
display: table-row;}

HTML:

<div class="dhDivRow><div class ="dhPictureDiv></div><div class ="dhInfoWrapper></div></div>

最佳答案

这已经被盖死了,但是给你:

http://jsfiddle.net/wu7TR/

我真的会建议简化你的类系统

.dhPictureDiv{
    background-color:red;
    height: 100px;
    display: table-cell;
    width: 100%;
}

.dhInfoWrapper{
    background-color:yellow;
    height: 100px;
    display: table-cell;
    min-width: 200px;
}

.dhDivRow {
    display: table;
}​

关于html - 使 div 占用所有剩余空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13744505/

相关文章:

javascript - 在框 CSS jquery 的其他图像上加载图像后面

html - 右对齐 Bootstrap 导航栏支持的内容

html - 如何解决这种奇怪的表格行为?

javascript - 内容可编辑的字数,包括默认文本

html - 更改组合框样式

html - Twitter Bootstrap 3 pull-right 卡在小窗口上

html - 如何在ie10中编码 "split screen view"

HTML 对齐文本和图标

html - 在 HTML/CSS 中对齐三个对象

javascript - jQuery - 选择元素子元素的子元素