// 文字超出几行隐藏,最多5行 // 使用超出1行隐藏,如果使用了flex,则需要给父元素设置min-width: 0; @for $i from 1 through 5 { .line-#{$i} { @if $i == 1 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } @else { display: -webkit-box !important; overflow: hidden; text-overflow: ellipsis; word-break: break-all; -webkit-line-clamp: $i; -webkit-box-orient: vertical !important; } } } * { box-sizing: border-box; } .container{ width: 100vw; min-height: 100vh; background-image: linear-gradient(to bottom, #050114, #133682); padding: 18rpx 33rpx; color: #fff; }