overflow(超出部分省略號)


溢出:
overflow:visible/hidden/scroll/auto/inherit;

visible:默認值、不剪切。
hidden:超出部分剪切、沒有滾動條。
scroll:超出部分有滾動條。
auto:自適應,有滾動條。
inherit:繼承父元素的overflow得值。

空余空間:
white-space:pre/pre-wrap/nowrap/pre-line/inherit;

pre:識別回車和空格、不換行。
pre-wrap:識別回車和空格、換行。
nowrap:不識別回車和空格、不換行。
pre-line:識別回車、不識別空格、識別換行。
inherit:繼承父元素的white-space屬性。


實例:
(1)單行實現省略號:

width:valve;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipse;

(2)

可以不要設置高 自適應 別忘了overflow:hidden;

.box{
  width: 100%;
// height: .70rem;
// line-height: .36rem;
  margin: .2rem 0 .4rem;
  font-size: .28rem;
  overflow: hidden;
}

//超出部分隱藏(可設置多行之后省略號)

//兩行超出隱藏
.overhide {
  display: -webkit-box !important;
  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
//一行超出隱藏
.overhideline1 {
  display: -webkit-box !important;
  text-overflow: ellipsis;
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM