html - 带有垂直文本和文本溢出的表格

标签 html css

我在这里搜索这个问题,感谢一些人,我找到了我想要的东西,但是,还有一件事我想做,那就是垂直文本上的文本溢出。 到目前为止,这种技术在水平文本上效果很好

td {
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

但这里不会按我想要的方式工作。文本需要用点隐藏起来,如果你明白我的意思的话

.container {
	width: 1058px;
	margin: 100px auto;
}
.table-frame table {
	width: 100%;
	font-size: 12px;
}
.table-frame table,
.table-frame th,
.table-frame td {
	border: 1px solid #010101;
	border-collapse: collapse;
	text-align: center;
	padding: 5px;
	vertical-align: bottom;
}
.table-frame thead {
	background-color: #AAA;
}
.sector td {
	vertical-align: top;
}
.sector th,
.sector td {
	text-align: left;
	
}
.sector thead tr {
	height: 150px;
}
.sector thead tr th:first-child {
	width: 150px;
	white-space: nowrap;
}
.sector th.rotate {
  height: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sector th.rotate > div {
  transform: rotate(270deg);
  width: 1px;
}
<body>
  <div class="container">
    <div class="table-frame sector">
      <table>
        <thead>
          <tr>
            <th>Some text some text some text</th>
            <th class="rotate"><div><span>Column header 1 text need to be hidden with dots</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
            <th class="rotate"><div><span>Column header 1</span></div></th>
          </tr>
        </thead>
      </table>
    </div>
  </div>
</body>

最佳答案

如果您可以使用固定尺寸,请提供文本溢出属性:

 white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 130px;

这是一个有效的 fiddle : https://jsfiddle.net/kLzg7gr3/1/

关于html - 带有垂直文本和文本溢出的表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31378047/

相关文章:

javascript - 为棋盘游戏选择的语言(flash 或 HTML5/JS)

javascript - 显示带条件的 Bootstrap 警报 (Vue.js) : how can I access this variable in order to change its value?

css - 如何定位 h2 中的元素

html - CSS 布局在 ie 中失败,在 Opera 中有小错误。帮助?

jquery - Bootstrap 4 - 透明粘性导航栏

android - WebView 未加载网页

javascript - UL 标签不显示与 OL 相同的 css

javascript - 使用自定义 JQuery 文件

html - 在同一窗口 html 中打开窗口

html - "data-pay-btn"BUTTON 元素没有指定的 CSS。我该如何解决