text-overflow 當(dāng)屬性規(guī)定當(dāng)文本溢出包含元素時(shí)發(fā)生的事情
clip: 修剪文本
ellipsis : 用省略號(hào)來代表被修剪的文字
string: 使用給定的字符串來代表被修剪的文字
重點(diǎn)是三個(gè)同時(shí)使用:
text-overflow:ellipsis;
white-space:nowrap;
overflow:hidden;
設(shè)置最高高度..超過后可以滑動(dòng)
max-height: 550rpx;
overflow-y: scroll;
換行
- 強(qiáng)制不換行
white-space:nowrap; - 自動(dòng)換行
div{
word-wrap: break-word;
word-break: normal;
} - 強(qiáng)制英文單詞斷行
div{
word-break:break-all;
}
用純CSS創(chuàng)建一個(gè)三角形
原理把上相艇、左在刺、右三條邊隱藏掉(顏色設(shè)為 transparent)
.demo {
width: 0;
height: 0;
border-width: 20px;
border-style: solid;
border-color: transparent transparent red transparent;
}
overflow: hidden當(dāng)強(qiáng)制不換行的時(shí)候,使用overflow:hidden隱藏超過界面的部分
設(shè)置最高高度..超過后可以滑動(dòng)
max-height: 550rpx;
overflow-y: scroll;
小程序邊框線太粗了怎么辦
::after {
position: absolute;
content: '';
width: 100%;
left: 0;
bottom: 0;
height: 1rpx;
background-color: #e3e5e9;
-webkit-transform: scale(1, 0.5);
transform: scale(1, 0.5);
-webkit-transform-origin: center bottom;
transform-origin: center bottom;
}
內(nèi)容文本保留3(n)行,溢出顯示...
display:-webkit-box;
word-break:break-all;
text-overflow:ellipsis;
white-space:normal;
overflow:hidden;
-webkit-box-orient:vertical;
-webkit-line-clamp:3;
color:#666666;