【发布时间】:2013-07-07 01:04:20
【问题描述】:
我需要截断文本,使其填充svg 矩形的大小,然后在mouse-over 上弹出到其全尺寸。
我曾尝试使用 css 使用以下代码隐藏文本然后弹出,但它似乎不起作用。
#text_trunc {
width: 100px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
#text_trunc:hover{
overflow: visible;
white-space: normal;
width: auto;
position: absolute;
background-color: rgba(0,0,0,0);
}
我已经使用javascript 创建了所有svg 元素,这就是我为文本元素创建id 的地方
text.setAttributeNS(null, "id", "text_trunc");
我最好的猜测是svg 创建了一个不能被css 截断的图像......仍然需要一个解决方案。提前致谢
【问题讨论】:
标签: javascript jquery css svg truncate