這裏的是什麼,我想工作的罰款一個例子,如果股利是用最小高度機體的子元素:如何讓內部的div至少匹配身體的高度?
<!DOCTYPE html>
<html>
<head>
<style>
html,body{
margin: 0;
padding: 0;
height: 100%;
}
.outer-wrap{
min-height: 100%;
}
.table-layout{
display: table;
min-height: 100%;
width: 100%;
}
.table-cell{
display: table-cell;
width: 50%;
padding: 2%;
}
.blue{
background: #55a;
}
.grey{
background: #bbb;
}
</style>
</head>
<body>
<div class="outer-wrap">
<div class="table-layout">
<div class="table-cell blue">
test
</div>
<div class="table-cell grey">
content<br />
<br />
content<br />
<br />
content<br />
<br />
</div>
</div>
</div>
</body>
</html>
https://codepen.io/anon/pen/OjxmGj
然而,當我添加的外層div與MIN-高度:100%;內格不再填充體的高度:
<!DOCTYPE html>
<html>
<head>
<style>
html,body{
margin: 0;
padding: 0;
height: 100%;
}
.outer-wrap{
min-height: 100%;
}
.table-layout{
display: table;
min-height: 100%;
width: 100%;
}
.table-cell{
display: table-cell;
width: 50%;
padding: 2%;
}
.blue{
background: #55a;
}
.grey{
background: #bbb;
}
</style>
</head>
<body>
<div class="table-layout">
<div class="table-cell blue">
test
</div>
<div class="table-cell grey">
content<br />
<br />
content<br />
<br />
content<br />
<br />
</div>
</div>
</body>
</html>
https://codepen.io/anon/pen/JyrNVj
這不是一個真正實用的,我更新整個佈局得到這個工作,所以我希望有一種方法能使得這項工作沒有刪除外部股利。
哇,這個作品完美,我從來沒有聽說過vh!非常有用,謝謝! – user7862512