文本溢出CSS截断 [英] Text-overflow CSS truncation

查看:187
本文介绍了文本溢出CSS截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前我是使用JS ..动态使用JS ..但我们得到一些性能问题,我们必须提供一个替代选项。

Earlier i was doing it dynamically using JS.. but we were getting some performance issues cuz of which we have to come with an alternative option.

我现在使用文本溢出样式截断我的标签名称上的长文本。

I am now truncating a long text on my tab names using text-overflow style.

一个小问题,如果有人可以解决它

but i have a small issue if some one can resolve it

目前这是我的文本截断看起来像

currently this is how my text truncation looks like

这里的三个点(...)是黑色的,我想把它改成红色。

Here the three dots (...) comes in black colour and i want to change it to red.

有没有办法达到这个目的?

推荐答案

在这里工作:

  • http://jsfiddle.net/TReRs/4/

代码(HTML& CSS) / p>

Code (HTML & CSS):

<div class="overme">
    how much wood can a woodchuck chuck if a woodchuck could chuck wood?
</div>

CSS:

.overme {
    width: 300px;
    overflow:hidden; 
    white-space:nowrap; 
    text-overflow: ellipsis;
    color: red;
}

尾随点/省略号使用基本CSS以红色显示。

Trailing dots/ellipsis are colored in red using that basic CSS.

这篇关于文本溢出CSS截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆