【发布时间】:2017-11-13 22:38:24
【问题描述】:
这可以仅使用 HTML 和 CSS 来完成吗? 下面是我试过的代码。问题在于鼠标悬停在同一单元格中显示它并更改表格的宽度。有没有办法将文本显示为弹出框?
table td.text {
max-width: 10px;
}
table td.text span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
max-width: 100%;
}
table td.text span:hover {
background-color: #BDE5F8;
overflow: visible;
white-space: normal;
height: auto;
/* just added this line */
}
<table>
<thead>
<tr class="text-center">
<th>Column1</th>
<th>Column2</th>
<th>Column3</th>
</tr>
</thead>
<tr>
<td class="text"><span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</span></td>
<td class="text"><span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</span></td>
<td class="text"><span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</span></td>
</tr>
</table>
【问题讨论】:
标签: javascript jquery html css angularjs