SOURCE

console 命令行工具 X clear

                    
>
console
<div class="box">
  <div class="box_text">哇哈哈哈哈哈哈啊哈哈啊啊哈哈哈哈哈啊哈哈哈哈哈哈哈安徽安徽啊哈哈哈和哇哈哈哈哈哈哈啊哈哈啊啊哈哈哈哈哈啊哈哈哈哈哈哈哈安徽安徽啊哈哈哈和</div>
</div>
.box {
  /* width: 100px; */
  border: 1px solid;
  
  /* 方法一: */
  /* display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 3; */
  
  /* 方法二: */
  /* padding-right: 1em;
  position: relative;
  line-height: 1.2em;
  max-height: 3.6em;
  text-align: justify;
  overflow: hidden;
  &:before {
    content: '...';
    position: absolute;
    right: 0;
    bottom: 0;
  }
  &:after {
    content: '';
    position: absolute;
    right: 0;
    width: 1em;
    height: 1.2em;
    background: #fff;
    z-index: 10;
  } */
  
  /* 方法三 */
  /*需要定高*/
    height: 100px;
    line-height: 25px;
    text-align: justify;
    overflow: hidden;
    background: #fff;
    &:before {
      float: left;
      width: 1em;
      height: 100%;
      content: ''; 
    }
    &:after {
      float: right;
      width: 2.5em;
      height: 25px;
      margin-left: -2.5em;
      padding-right: 1em;
      content: '...';
      text-align: right;
      position: relative;
      top: -25px;
      left: 100%;
      background: #fff;
      background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), to(white), color-stop(50%, white));
      background: -moz-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white);
      background: -o-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white);
      background: -ms-linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white);
      background: linear-gradient(to right, rgba(255, 255, 255, 0), white 50%, white);
    }
    &_text {
      float: right;
      margin-left: -1em;
      width: 100%;
    } 
}