亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

當遇到多行的文本,固定了高度的情況下,這又該如何寫呢?

當遇到多行的文本,固定了高度的情況下,這又該如何寫呢?

三國紛爭 2023-04-14 18:14:59
在單行文本的情況下,可以用來使超出范圍的文本用省略號隱藏:overflow: hidden;text-overflow: ellipsis;white-space: nowrap;像下面這個文本一樣,結尾是 "..."+------------------------------------------+| Over the past day or so the vituperation | | against the iOS 6 Maps app, AKA the Maps || app that makes you wish you were ...     | +------------------------------------------+
查看完整描述

2 回答

?
慕桂英3389331

TA貢獻2036條經驗 獲得超8個贊

利用
overflow:hidden;
position:relative;
::after
實現,很巧妙。

查看完整回答
反對 回復 2023-04-17
?
白豬掌柜的

TA貢獻1893條經驗 獲得超10個贊

Webkit支持一個名為-webkit-line-clamp的屬性,他其實是一個WebKit-Specific Unsupported Property

p {    overflow : hidden;    text-overflow: ellipsis;    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
p {    overflow: hidden;    white-space: normal;    height: 3em;    text-overflow: -o-ellipsis-lastline;
}

簡單地說,就是沒有標準的解決方案,對于這類需求,最好在后端處理或者前端用腳本做截斷

查看完整回答
反對 回復 2023-04-17
  • 2 回答
  • 0 關注
  • 132 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號