文字溢出内容通过三个小点隐藏


//单行文本溢出解决方案:
p {
white-space:nowrap;
text-overflow:ellipsis;
overflow: hidden;
width: 210px;
//一定要给宽度
}


//多行文本解决方案(只有谷歌生效)
.mui-ellipsis-3 {
display: -webkit-box;
overflow: hidden;
white-space: normal!important;
text-overflow: ellipsis;
word-wrap: break-word;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}

// 多行文本溢出隐藏方案(兼容):
.block-with-text {
  /* hide text if it more than N lines  */
  overflow: hidden;
  /* for set '...' in absolute position */
  position: relative;
  /* use this value to count block height */
  line-height: 1.2em;
  /* max-height = line-height (1.2) * lines max number (3) */
  max-height: 3.6em;
  /* fix problem when last visible word doesn't adjoin right side  */
  text-align: justify;
  /* */
  margin-right: -1em;
  padding-right: 1em;
}
.block-with-text:before {
  /* points in the end */
  content: "...";
  /* absolute position */
  position: absolute;
  /* set position to right bottom corner of block */
  right: 0;
  bottom: 0;
}
.block-with-text:after {
  /* points in the end */
  content: "";
  /* absolute position */
  position: absolute;
  /* set position to right bottom corner of text */
  right: 0;
  width: 1em;
  /* set width and height */
  height: 1em;
  margin-top: 0.2em;
  background: white;
}

文章作者: Robyn
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Robyn !
评论
 上一篇
vue脚手架升级记录 vue脚手架升级记录
一、版本情况 从脚手架2.x版本升级到4.1.1 二、配置对比 从官网下载2.x 的脚手架下来,然后用文件夹对比工具对比了一下config目录以及build目录,目前自己项目之间改动的差异,发现有以下改动的地方要留意 官网2.x cl
2019-12-19
下一篇 
弹窗之后禁止页面滚动 弹窗之后禁止页面滚动
let bodyEl = document.body let top = 0 function stopBodyScroll (isFixed) { if (isFixed) { top = window.scrollY
2018-11-05
  目录