CSS3如何实现超出指定文本以省略号显示效果

如题所述

超出指定文本以省略号显示效果,用css的"text-overflow:ellipsis;"实现

text-overflow:ellipsis;  æº¢å‡ºçš„部分用 省略号 表示。

<!DOCTYPE html>
<html>
<head>
<style> 
div.test
{
    white-space:nowrap; 
    width:123px; 
    overflow:hidden; 
    border:1px solid #000000;
    text-overflow:ellipsis;
}
</style>
</head>
<body>
    <p>这个 div ä½¿ç”¨ "text-overflow:ellipsis" ï¼š</p>
    <div class="test">
        This is some long text that will not fit in the box
    </div>
</body>
</html>

在div块中要设置宽度,"overflow:hidden;"要跟"text-overflow:ellipsis;"使用才行

温馨提示:内容为网友见解,仅供参考
第1个回答  2019-02-14

订单的的

随风倒随风倒十分撒地方撒地方

相似回答