Is it possible to make .item-1
height flexible and adjust .item-2
height? For example:
- if
.item-1
height is10%
then.item-2
height is90%
- if
.item-1
height is11%
then.item-2
height is89%
So depending on the content of the .item-1
we should resize it.
HTML
<div class="container">
<div class="item item-1">1</div>
<div class="item item-2">2</div>
</div>
CSS
html,
body,
.container {
height: 100%;
}
.container {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column;
-moz-flex-flow: column;
-ms-flex-flow: column;
flex-flow: column;
}
.item {
background: #eee;
margin: 1px;
}
.item-1 {
-webkit-box-flex: 3 3 100%;
-moz-box-flex: 3 3 100%;
-webkit-flex: 3 3 100%;
-ms-flex: 3 3 100%;
flex: 3 3 100%;
}
.item-2 {
-webkit-box-flex: 1 1 100%;
-moz-box-flex: 1 1 100%;
-webkit-flex: 1 1 100%;
-ms-flex: 1 1 100%;
flex: 1 1 100%;
}
JSFiddle: http://jsfiddle.net/vpetrychuk/SYZtg/2