如果网址较长,则省略号不能正常工作。对于URL,它将/视为特殊字符,并且每次出现/时都会中断。
.ui-jqgrid tr.jqgrow td
{
font-weight: normal;
overflow: hidden;
text-overflow: ellipsis;
-moz-binding:url('ellipsis-xbl.xml#ellipsis');
white-space: normal !important;
height: 22px;
padding: 4px 2px 4px 2px;
border-bottom-width: 1px;
border-bottom-color: inherit;
border-bottom-style: solid;
}
知道如何在省略号中转义特殊字符吗?
您需要进行设置white-space: nowrap;
,以使省略号行为按预期工作。
的HTML
<div class='ellipsis'>http://stackoverflow.com/questions/22609623/ellipsis-not-working-for-long-url</div>
的CSS
.ellipsis {
font-weight: normal;
overflow: hidden;
text-overflow: ellipsis;
-moz-binding:url('ellipsis-xbl.xml#ellipsis');
white-space: nowrap;
height: 22px;
padding: 4px 2px 4px 2px;
border-bottom-width: 1px;
border-bottom-color: inherit;
border-bottom-style: solid;
width:100px; /* set as an example */
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句