垂直扩展div到其他div的边界 - 两者都是绝对定位的

时间:2014-06-16 19:52:24

标签: html css position absolute expand

我有两个绝对定位的div,一个固定在左上角,另一个固定在左下角。他们都有文字。 div.top的高度扩展以适应其内容(可以变化)。相反,div.bottom的高度应该扩展到div.top的底部。

Fiddle

 body { 100%; margin:0 }

 .top { / * div expands to fit-content */
     position: absolute;
     top:0; left:0;
     height: auto; 
     width: 30%;
     border: 1px solid;
 }

 .bottom { /* div.bottom top should match div.top bottom */
     position: absolute;
     bottom:0;left:0;
     width: 30%;
     border: 1px solid;
 }

0 个答案:

没有答案