微信小程序 css使用技巧總結
更新時間:2017年01月09日 11:44:45 投稿:lqh
這篇文章主要介紹了微信小程序 css使用技巧總結的相關資料,需要的朋友可以參考下
微信小程序 css使用技巧
1:用純CSS創(chuàng)建一個三角形的原理把上、左、右三條邊隱藏掉(顏色設為 transparent)
.demo {
width: 0;
height: 0;
border-width: 20px;
border-style: solid;
border-color: transparent transparent red transparent;
}
2:設置最高高度..超過后可以滑動
max-height: 550rpx; overflow-y: scroll;
3: text-overflow 當屬性規(guī)定當文本溢出包含元素時發(fā)生的事情
clip: 修剪文本 ellipsis : 用省略號來代表被修剪的文字 string: 使用給定的字符串來代表被修剪的文字 重點是三個同時使用:text-overflow:ellipsis; white-space:nowrap; overflow:hidden;
4:overflow: hidden當強制不換行的時候,使用overflow:hidden隱藏超過界面的部分
5: margin-bottom失效
margin-bottom是下方的外邊距,并不能讓元素向下方移動,margin-top作為上邊距,把元素“推”了下去。 希望圖標距離下方30px,那么可以在ul上設置 position:absolute, bottom:30px ,(這一句我沒有加同樣實現(xiàn)了效果)另外父元素position:relative
6:強制不換行
white-space:nowrap;
自動換行
div{
word-wrap: break-word;
word-break: normal;
}
強制英文單詞斷行
div{
word-break:break-all;
}
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關文章
TypeScript中type和interface的區(qū)別及注意事項
type的類型別用可以用戶其他的類型,比如聯(lián)合類型、元祖類型、基本類型,interface不行,下面這篇文章主要給大家介紹了關于TypeScript中type和interface的區(qū)別及注意事項的相關資料,需要的朋友可以參考下2022-10-10
js location.replace與location.reload的區(qū)別
js location.replace與location.reload的區(qū)別,經(jīng)常能用的到,需要的朋友可以可以下。2010-09-09

