无法在IE9和IE8中的链接文本上获得省略号

时间:2012-11-06 19:28:57

标签: html css dom

<div class="jspPane" style="padding: 0px; top: 0px; width: 138px;">
   <ul style="display: block;">
     <li class="hyperlink" >
        <span class="xyz1" style="background-image:url(/Content/images/icon_link_16x7.png);"> View on Bing Maps website</span>
    </li>
  </ul>
</div>

//// class //

 ul li {
    color: #137AFF;
    height: 25px;
    overflow: hidden;
    padding-left: 5px;
    padding-right: 4px;
    padding-top: 4px;
    text-align: left;
    text-overflow: ellipsis;
    width: 138px;
}
.hyperlink {
    color: #13A3F7;
    font-size: 12px !important;
    text-decoration: underline;
    white-space: nowrap;
}

我的问题是我希望在最里面的跨度内的文本上得到省略号。我无法在IE9和IE8上获得省略号。它在Fire Fox中运行良好。我尝试删除span并使用div代替,但它没有帮助。如果我遗漏了任何东西,请告诉我。所有帮助表示赞赏。谢谢。

5 个答案:

答案 0 :(得分:8)

据我所知,阅读msdn developer article regarding text-overflow,您需要使用-ms-text-overflow

ul li {
    color: #137AFF;
    height: 25px;
    overflow: hidden;
    padding-left: 5px;
    padding-right: 4px;
    padding-top: 4px;
    text-align: left;
    text-overflow: ellipsis;
    -ms-text-overflow: ellipsis;
    width: 138px; /* note that this width will have to be smaller to see the effect */
}

DEMO

答案 1 :(得分:4)

white-space:nowrap; 是这里的关键,Daedalus引用的文章实际上甚至没有在its own code example中使用该类属性值。

ul li {
color: #137AFF;
height: 25px;
overflow: hidden;
padding-left: 5px;
padding-right: 4px;
padding-top: 4px;
text-align: left;
width: 138px;
text-overflow: ellipsis;
**white-space:nowrap;**
}

Working example

答案 2 :(得分:4)

这些是我的设置,它们有效:

    .node-title {
        width: 90%;
        font-size: 95%; 
        color: #4d4d4d; 
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
        word-wrap: normal !important;
    }

答案 3 :(得分:2)

即使其他两个答案都是正确的,但如果您使用自定义字体,则问题 ,例如。 Google WebFonts。

自定义字体的IE8渲染省略号演示错误:
http://jsbin.com/odiqux/1

答案 4 :(得分:0)

@micadelli,我在IE9中遇到了类似的问题,我在文本之前有一个基于Web字体的图标应该用省略号呈现。

解决方案是将其添加到课程中:

.node-title:before {
    content: '';
}

请参阅Font-AwesomeBootstrap上的此问题: