css只显示1行,超出显示... 和 -webkit-box-orient编译后消失问题

本文详细解析了CSS中处理文本溢出及换行的问题,包括使用overflow、white-space、text-overflow等属性的技巧。同时,介绍了如何通过-webkit-line-clamp属性实现多行文本省略,并提供了在不同情况下解决问题的四种方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

overflow:hidden !important;
white-space: nowrap !important;
text-overflow: ellipsis !important;
word-wrap: normal !important;

识别换行符:
white-space: pre-wrap;
// line-height: 1.5

代码:

word-break: break-all;
display: -webkit-box;
text-overflow: ellipsis;
overflow: hidden;
-webkit-line-clamp: 1;
/* autoprefixer: ignore next */
-webkit-box-orient: vertical;

-webkit-box-orient: vertical 属性编译后丢失问题详解

解决方案一

/* autoprefixer: off*/
 -webkit-box-orient: vertical; 
/* autoprefixer: on*/

不忽略了,但是会报警告 如下:
在这里插入图片描述
解决方案二

/* autoprefixer: ignore next */
-webkit-box-orient: vertical;

问题完美解决,也不报警告。

方案三:
在html写内联样式

方案四:
更改webpack配置

方案三和四请参考:
https://blog.csdn.net/weixin_41544124/article/details/92646582

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值