1

我有以下 HTML 可以在这个小提琴中看到:

<div id="parent">
    <div id="a" class="grid_6" style="background-color: #ff00ff">
        <div class="block-border">
            <div style="background-color: #123456">
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
            </div>
        </div>
    </div>
    <div id="b" class="grid_6" style="background-color: #ffff00">
        <div class="block-border">
            <div id="xx" style="background-color: red;">
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
            </div>
        </div>
    </div>
</div>

如何使 id="xx" 的 DIV 扩展高度以填充包含的 DIV?

4

1 回答 1

-1

如果您设置.grid_6to haveposition: relative并且#xxto haveheight: 100%; position: absolute;它应该可以工作。虽然,这可能并不理想。

#parent {
    display: table-row; 
}

.grid_6 {
    position: relative;
    display: table-cell;
    width: 50%;       
}

#xx {
    height: 100%;
    position: absolute; 
}

将此小提琴视为一个工作示例。

于 2013-02-13T21:41:18.347 回答