我需要垂直对齐3个块,其中中心块应占用剩余空间,并且横向块是自动调整的。
我的代码(PEN):
.parent {
background: lightgray;
//display: table;
}
[class|="i"] {
display: inline-block;
//display: table-cell;
padding: 5px;
margin: 0;
}
.i-left {
background: green;
}
.i-full {
background: lightgreen;
width: 30%;
vertical-align: middle;
}
.i-right {
background: lightblue;
}

<div class="parent">
<div class="i-left">[min space left long size]</div>
<div class="i-full">
[long content to fill the row long content to fill the row long content to fill the row long content to fill the row long content to fill the row long content to fill the row long content to fill the row long content to fill the row long content to fill the row]
</div>
<div class="i-right">[min space right]</div>
</div>
&#13;
=== 限制
table
的变体被注释掉并不尊重这一点); flex
(因为IE9不兼容); 答案 0 :(得分:3)
布局的CSS表格和&#34;自动调整大小的#{1}}左/右单元格,因此文本不会换行。
white-space:nowrap
&#13;
.parent {
background: lightgray;
display: table;
}
[class|="i"] {
display: table-cell;
padding: 5px;
margin: 0;
vertical-align: middle;
}
.i-left {
background: green;
white-space: nowrap
}
.i-full {
background: lightgreen;
}
.i-right {
background: lightblue;
white-space: nowrap
}
&#13;