简体   繁体   English

CSS文字溢出因为断字而无法正常工作

[英]CSS Text overflow not working because word-break

If a write this sentence in a width 90px and height 20px with text overflow property: 如果用文本溢出属性以宽90像素,高20像素的形式写此句子:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Will display: 将显示:

aaaaaaaaaaaaaa... aaaaaaaaaaaaaaaa ...

The text-overflow property will work, but if the sentence is: text-overflow属性将起作用,但是如果句子是:

THISISASENTENCE 这句话

It will display: 它将显示:

T H I S I S A 
S E N T E N C
E

The line will break and the text-overflow property won't work. 该行将中断并且text-overflow属性将不起作用。

How can I get this to work correctly? 我如何才能使其正常工作?

Add: 加:

white-space:nowrap;

See this fiddle 看到这个小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM