text-overflow:ellipsis 显示省略符号来代表被修剪的文本
浏览器支持性:所有主流浏览器都支持(chrome、ie、firefox、safari、opera)
注意:下面这些css属性要一起使用(text-overflow适用块级元素)
overflow: hidden;
text-overflow:ellipsis;
white-space:nowrap;
显示省略号来代替被修剪的文本经常用在列表显示(Web移动端)。
text-overflow的另一个属性值clip会修剪文本。
添加hover事件显示全部内容,如下所示:
div.test:hover
{
text-overflow:inherit;
overflow:visible;
}
相关推荐
今天在做jsp页面展示的时候碰到一个实现溢出文本显示省略号的需求 原本使用js截取字符串然后判断字符串长度实现,不过相对比较繁琐,并且字符串长度不能自适应 听说用css的 text-overflow: ellipsis 也可以实现,...
NULL 博文链接:https://zsp.iteye.com/blog/261175
字超出规定范围时,可以用省略号显示,这里我们可以使用text-overflow:ellipsis来实现省略号显示,下面有个不错的示例,感兴趣的朋友可以参考下
string:可自定义符号来表示放不下的字符 <!DOCTYPE html> <html lang=en> <head> <meta charset=UTF-8> <title></title> <style type=text/css> .tf{ width:
首先平时用的时候要配合 复制代码代码如下: overflow: hidden; white-space: nowrap; 这两个属性让起溢出隐藏和不换行,然后IE8用的时候记得不要加 复制代码代码如下: word-berak:break-all;... -o-text-overflow
大家应该都知道用text-overflow:ellipsis属性来实现单行文本的溢出显示省略号(…)。当然部分浏览器还需要加宽度width属性。 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; 但是这个属性并不...
定义文本样式 css3与html5源码3种 ... -o-text-overflow: ellipsis; /* Opera */ text-overflow: ellipsis; /* IE, Safari (WebKit) */ [removed]: url('ellipsis.xml#ellipsis'); /* Firefox */ } </style>
text-overflow:ellipsis; //溢出用省略号显示 white-space:nowrap; //溢出不换行 但是第三条属性,只能显示一行,不能用在这里,那么如果显示多行呢? 超出两行隐藏: css3解决了这个问题,解决方法如下: display:-...
text-overflow属性仅是注解,当文本溢出时是否显示省略标记。并不具备其它的样式属性定义。我们想要实现溢出时产生省略号的效果。还必须定义:强制文本在一行内显示(white-space:nowrap)及溢出内容为隐藏
所谓省略就是把多余的字以“…”显示出来,而显示则是当鼠标移动到td上时,把省略的字重新显示出来。对于一个table,兼容IE与FF、Chrome的省略方式CSS写法: 复制代码代码如下: table{ width:200px; table-layout: ...
text-overflow:ellipsis; overflow:hidden; white-space:nowrap; font-size:36px; width:400px; } p { text-overflow:ellipsis; overflow:visible; white-space:nowrap; font-size:36px; width:400px; ...
text-overflow:ellipsis; text-overflow: ellipsis;/* IE/Safari */ -ms-text-overflow: ellipsis; -o-text-overflow: ellipsis;/* Opera */ -moz-binding: url("ellipsis.xml#ellipsis");/*FireFox*/ } 任意长度...
方法一:用CSS截断字符串:... text-overflow:ellipsis; text-overflow: ellipsis;/* IE/Safari */ -ms-text-overflow: ellipsis; -o-text-overflow: ellipsis;/* Opera */ [removed]: url(“ellipsis.xml#ellipsis”)
超过宽度显示省略号(无js无hack全兼容) .
复制代码代码如下: li{ display:block; font-size:14px; height:16px; line-height:16px; width:330px; white-space:nowrap;...1、语法: text-overflow : clip | ellipsis 参数: clip : 不显示省略标记(…),而是
难免会出现文字内容超过div(或其他标签,下同)区域的情况,此时比较好的做法就是当文字超过限定的div宽度后自动以省略号(…)显示,这样,按照习惯,人们都会知道这儿有文字被省略了。css中有个属性叫做text-...
禁用页面滚动条的方法有很多,但最简单、最快的也就数overflow: hidden了,下面是禁用html及body滚动条的方法,兼容IE6、7
程序員常用 display: block;width: 150px;overflow: hidden;white-space: nowrap;-o-text-overflow: ellipsis;text-overflow: ellipsis