html - 添加大量文本时 tr/td 拉伸(stretch)

标签 html css

当添加大量文本时,我的 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/

相关文章:

html - 如何在媒体查询中的页脚下设置页眉

android - Android 和桌面上的不同 View

javascript - 当 url 上已有 # anchor 时如何滚动到特定元素

html - CSS 网格系统无法正常工作

html - :hover but not stays after visiting link 后 anchor 标签背景发生变化

Javascript使圆圈正确命中 Canvas 边框

html - 最后一个 div 和最后一列的边距

javascript - 如果 URL 中的 # 之后存在某些内容,是否显示 CSS DIV?

css - Flexbox 容器不拉伸(stretch)高度

html - 在背景图像上重叠文本