相关疑难解决方法(0)

如何隐藏表行溢出?

我有一些html表,文本数据太大,不适合.因此,它会垂直扩展单元格以适应这种情况.因此,现在具有溢出的行的高度是具有较少数据量的行的两倍.这是无法接受的.如何强制表具有相同的行高1em

这是一些重现问题的标记.表应该只是一行的高度,隐藏溢出的文本.

<!DOCTYPE html>

<html>
  <head>
    <title>Test</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <style type="text/css">
      table { width:250px; }
      table tr { height:1em; overflow:hidden; }
    </style>
  </head>
  <body>
    <table border="1">
      <tr>
        <td>This is a test.</td>
        <td>Do you see what I mean?</td>
        <td>I hate this overflow.</td>
      </tr>
    </table>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

html css html-table

55
推荐指数
3
解决办法
10万
查看次数

标签 统计

css ×1

html ×1

html-table ×1