当添加大量文本时,我的 td/tr 会垂直拉伸(stretch)。无论显示多少文本,我都需要该行保持相同的大小(如果溢出则可滚动)
table {
display: inline-block;
table-layout: fixed;
width: 100%;
height: 480px;
overflow-y: scroll;
border-collapse: collapse;
border-top: none;
}
tr {
border-bottom: 1px solid white;
max-height: 40px;
min-height: 40px;
height: 40px;
padding: 5px;
}
td {
white-space: normal;
word-wrap: break-word;
font-size: 12px;
text-align: center;
overflow: none;
-webkit-appearance: none;
overflow-y: none;
max-height: 40px;
min-height: 40px;
overflow-x: scroll
}
最佳答案
如何添加
td {
white-space: normal;
word-wrap: break-word;
font-size: 12px;
text-align: center;
-webkit-appearance: none;
max-height: 40px;
min-height: 40px;
width: 14.28%;
overflow: auto;
}
到您的 CSS。
关于html - 添加大量文本时 tr/td 拉伸(stretch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48740122/