首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >表格单元格上的垂直文本溢出

表格单元格上的垂直文本溢出
EN

Stack Overflow用户
提问于 2018-02-05 03:31:05
回答 2查看 1.3K关注 0票数 0
代码语言:javascript
复制
   .table {
  table-layout: fixed;
  }
  .text-overflow {
  display:block;
  overflow-y: scroll;
  white-space: nowrap;
  text-overflow: ellipsis;
  }

  .cell-4 {
  width: 200px;
  }

https://codepen.io/mstone6769/pen/dodJEz

如何使表格单元格垂直溢出?我试着用溢出-y,但没有起作用

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-02-05 03:38:02

您必须允许文本在.text-overflow更新的css中包装

代码语言:javascript
复制
.text-overflow {
  display: block;
  height: 20px;
  overflow: auto;
}
票数 0
EN

Stack Overflow用户

发布于 2018-02-05 03:41:13

overflow: scroll

代码语言:javascript
复制
.table {
  table-layout: fixed;
  width: 400px;
  /* Just for the example */
}

.text-overflow {
  display: block;
  overflow: scroll;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell-4 {
  width: 200px;
}
代码语言:javascript
复制
<div class="container-fluid">
  <h1>Text overflow in a table cell</h1>
  <table class="table">
    <thead>
      <tr>
        <th>Column 1</th>
        <th>Column 2</th>
        <th>Column 3</th>
        <th>Column 4</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Cell 1</td>
        <td>Cell 2</td>
        <td>Cell 3</td>
        <td class="cell-4">
          <span class="text-overflow">Ccell 4 is really really long and needs to wrap because it's so long</span>
        </td>
      </tr>
    </tbody>
  </table>
</div>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48615506

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档