在内容较大的表格单元格中引导工具提示偏离中心
bootstrap tooltips off-center in table cells with large content
我有一个在一些单元格中带有链接的表。这些链接中的文本可能相当长。隐藏表格单元格的溢出,因此所有单元格的宽度相同。当我在标签上放置引导工具提示时,这会导致一个问题,因为工具提示会向右移动到链接文本隐藏宽度的中心。
这里是一个小提琴演示我的问题:http://jsfiddle.net/zjy1t9s7/
<table class="table table-condensed table-hover">
<tbody>
<tr>
<td >
<a data-original-title="666" data-toggle="tooltip" data-placement="bottom" title="">
This link has an incredibly long text which shifts the entire tooltip outside of the table cell, I personally think this looks like shit and want to fix it. Let's see if I can reproduce it here.
</a>
</td>
<td >
<a data-original-title="555" data-toggle="tooltip" data-placement="bottom" title="">
These are not as big
</a>
</td>
<td >
<a data-original-title="555" data-toggle="tooltip" data-placement="bottom" title="">
These are not as big
</a>
</td>
<td >
<a data-original-title="555" data-toggle="tooltip" data-placement="bottom" title="">
These are not as big
</a>
</td>
</tr>
</tbody>
</table>
td {
border:1px solid #333;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 75px;
}
将鼠标悬停在第一个表格单元格上,看看我是什么意思。
这个是可修复的吗?
我尝试的第一件事是将tooltip-info添加到td-tag。但这引起了一点问题,所以我在它周围添加了一个div-wrapper,这对我来说很有效:
<td >
<div data-original-title="666" data-toggle="tooltip" data-placement="bottom" title="">
<a>
This link has an incredibly long text which shifts the entire tooltip outside of the table cell, I personally think this looks like shit and want to fix it. Let's see if I can reproduce it here.
</a>
</div>
</td>
添加css:
td > div {
max-width: 100%;
overflow:hidden;
text-overflow:ellipsis;
}
小提琴:https://jsfiddle.net/zjy1t9s7/1/
编辑:不使用div-wrapper更容易解决
添加到你的css:
td > a {
display:inline-block;
max-width:100%;
overflow:hidden;
text-overflow:ellipsis;
}
如, , <&>等文本标签需要定义为block-type displaystyle,如果你想指定宽度或使用padding小提琴:http://jsfiddle.net/zjy1t9s7/2/
相关文章:
- 使用jquery在单击时在单元格中输入值
- CSS-若窗口太小,滚动条会出现在“表格”单元格上
- 可以'我不明白为什么;t将行和单元格添加到表中
- 如何在Angular中的表的所有单元格中添加链接
- d3.js Chord图的动态工具提示
- 表中单元格的总和
- 单元格的工具提示或标题不显示超过2000个字符
- ExtJ将工具提示添加到网格单元格文本中
- 如何使用单击属性和工具提示动态创建表格单元格,该工具提示将超链接到页面
- 将 dojo 工具提示对话框添加到每个表格单元格
- 表格的不同单元格上的工具提示
- Kendo UI网格单元格中的工具栏菜单,菜单是从哪个行单击的
- 如何在jqgrid中显示格式化区域外单元格内容的正确工具提示
- 在工具提示中隐藏长表单元格内容
- 在内容较大的表格单元格中引导工具提示偏离中心
- ExtJS 5:电子表格拖动选择显示单元格工具提示
- 如何显示鼠标悬停标题单元格的工具提示?
- JS工具提示在表格单元格中的位置
- JQuery单元测试工具提示(jasmine, qunit等)
- 工具提示在表格单元格中不起作用