Coding常用css代码片段(二)Lieme2018-06-132024-01-041.限制单行文本超出显示省略号12345678910div{ width: 65px; height: 30px; line-height: 30px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px;} 2.限制多行文本超出省略号1234567div{ overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;} 3.css三角形绘制123456789101112131415161718192021222324252627282930313233/*向上*/.div{ width:0; height:0; border-width:0 30px 30px; border-style:solid; border-color:transparent transparent #333;/*透明 透明 灰*/}/*向下*/.div{ width:0; height:0; border-width:30px 30px 0; border-style:solid; border-color:#333 transparent transparent;/*灰 透明 透明 */}/*向左*/.div{ width:0; height:0; border-width:30px 30px 30px 0; border-style:solid; border-color:transparent #333 transparent transparent;/*透明 灰 透明 透明 */}/*向右*/.div span{ display:block; width:0; height:0; border-width:28px 0 28px 28px; border-style:solid; border-color:transparent transparent transparent #fc0;/*透明 透明 透明 黄*/} 4.自适应文本框自动换行,限宽不限高123456789div{ display: inline-block; min-height: 15px; max-width: 78%; padding: 12px 10px; text-align: left; font-family: Microsoft YaHei; word-wrap: break-word;}