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_6それposition: relative#xx機能height: 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 に答える