如何使用CSS为所有浏览器

时间:2015-06-02 10:55:21

标签: javascript html css

这对单行来说很好,但我想要它用于多行。



div {
    display: block;
    height: 54px;
    margin: 0 auto;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 300px;
}

<div>
    There are no questions currently added
    There are no questions currently added
    There are no questions currently added
</div>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

你需要添加如下所示的跨度

<div>
    <span>There are no questions currently added</span>
    <span>There are no questions currently added</span>
    <span>There are no questions currently added</span>
</div>  

DEMO

答案 1 :(得分:0)

可悲的是,你无法单独使用css。这是不可能的。你可以添加一些HTML标签,比如@ozil建议,或者你需要编写自己的JS解决方案。可能有一些插件,但一个简单的解决方案是,在x字符之后切断刺并添加三个点。