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