div结构的HTML和CSS问题

时间:2014-04-06 06:23:26

标签: html css twitter-bootstrap

我有两列设置,每个设置都有.col-md-6。左侧<div>应为白色背景,右侧<div>为灰色背景。

他们都应该坐在100%高度,但灰色<div>不想伸展到最大高度。我已将父.grey-right设置为亲戚,将子.preview-container设置为position: absolute。可能有什么不对?

此外,尽管.preview-container看起来正是我想要的,但我觉得我还没有完成编写HTML和CSS结构的好工作。我必须使用像.low-margin这样的选择器作为绑定修复程序。是否有更简洁的方法来构建此区域的HTML和CSS?

我正在使用我在Fiddle中引用的Twitter Bootstrap CSS。

CSS:

.grey-right {
    background: #eeeeee;
    position: relative;
}
.preview-container {
    position: absolute;
    top: 0;
    bottom: 0;
    height: 60%;
    width: 43%;
    margin: auto;
}
.data-title.low-margin {
    margin-top: 10px;
}

HTML:

<div class="data-title low-margin">Country
    <span class="data-input country-name">USA</span>
</div>

0 个答案:

没有答案