您好,欢迎访问一九零五行业门户网

HTML长文本截取含有HTML代码同样适用的两种方法_javascript技巧

方法一:用css截断字符串:ie,firefox,opera ,safari都兼容
复制代码 代码如下:
.sublongtext{
width:150px;
height:24px;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
text-overflow: ellipsis;/* ie/safari */
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;/* opera */
-moz-binding: url(ellipsis.xml#ellipsis);/*firefox*/
}
任意长度文本
方法二:用js截取
复制代码 代码如下:
jquery 文本截取方法
我是代码:$.fn.substr = function(l,c){ $(this).each(function(i,item)
以下两种方式都可以解决textarea行高自动适应类容的高度
以下两种方式都可以解决textarea行
其它类似信息

推荐信息