<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>多行截断</title>
<style>
.line1{
white-space:nowrap;/*这行是干嘛的*/
overflow:hidden;
text-overflow:ellipsis;
}
.line2{
display: -webkit-box;/*对象作为弹性盒子使用*/
-webkit-line-clamp: 2;/*不规则属性,只有webkit内核的浏览器才支持,移动设备大部分支持*/
-webkit-box-orient: vertical;/*设置或检索伸缩盒子对象的子元素的排列方式*/
overflow : hidden;
text-overflow: ellipsis;
}
.longtext{
width: 200px;
margin: 100px auto;
background: hotpink;
}
.wys{
position: relative;
line-height: 18px;
height: 36px;
overflow: hidden;
word-break:break-all;
}
.wys:after{/*该方法...会一直有,不适用*/
content: '...';
position: absolute;
right: 0;
bottom: 0;
padding: 0 20px 1px 45px;
background: -webkit-gradient(linear, left top, right top, from(rgba(255, 255
CSS实现多行文字截断
最新推荐文章于 2023-12-22 11:36:26 发布