Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在第n行末尾添加三个点_Jquery_Css - Fatal编程技术网

Jquery 在第n行末尾添加三个点

Jquery 在第n行末尾添加三个点,jquery,css,Jquery,Css,我们从后端获取内容,我们只需要显示三行。在第三行的末尾,我们需要加三个点 到目前为止,我所做的是得到三条线- var height = $(this).find('.sample').outerHeight(); var lineHeight = $(this).find('p').css('line-height'); $(this).find('.sample').css('max-height',lineHeight*3); .sample{overflow: hidden;} 这里

我们从后端获取内容,我们只需要显示三行。在第三行的末尾,我们需要加三个点

到目前为止,我所做的是得到三条线-

var height = $(this).find('.sample').outerHeight();
var lineHeight = $(this).find('p').css('line-height');
$(this).find('.sample').css('max-height',lineHeight*3);

.sample{overflow: hidden;} 
这里显示了三行。但是如何添加点呢?我尝试过webkits,但在ie上不起作用

您可以尝试以下方法:

  .add-three-dots{display: inline-block;

   width: 240px;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
   background: #FFFCD7;
    padding: 5px;
     }

如何使用Css和Jquery在字符串末尾添加三个点?

可能这段代码在IE浏览器

css选择器之后或通过jquery append(“…..”)“我尝试过webkits”-您尝试过哪些特定的“webkits”?请出示您的“”代码,以便我们重现您的问题,并为您和未来的访客提供具体可行的帮助。
      <span class="add-three-dots">How To Add Three Dots In the End Of String with Css And Jquery?</span>
div{
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-wrap:break-word;
}