我在display: table
div內有display: table-cell
div。有什麼辦法來限制身高嗎?我試過設置高度,最大高度和溢出:隱藏,但它沒有效果。 (height
不設置最低高度,但其他人似乎什麼也不做。在http://jsbin.com/gajaka/1/editCSS「table-cell」樣式元素:最大高度(和溢出:隱藏)
<div class='table'>
<div class='cell'>This should be maximum 100px. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>
CSS
.table {
display: table;
background: green;
width: 100px;
height: 100px;
max-height: 100px; /* ignored */
overflow: hidden; /* ignored */
}
.cell {
display: table-cell;
vertical-align: middle;
max-height: 100px; /* ignored */
text-align: center; /* doesn't work */
}
'表cell' =>讓元件表現得像一個''元件 – AvrilAlejandro 2014-10-08 17:08:49