“word-break:break-all”和“word-wrap:break-word”之间有什么区别? [英] What's the difference between `word-break: break-all` and `word-wrap: break-word`?

查看:177
本文介绍了“word-break:break-all”和“word-wrap:break-word”之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白为什么有两个属性似乎做同样的事情,但它们的相互关系似乎没有在规范中定义。

I don't understand why there are two properties that seem to do the same thing, yet their interrelation does not appear to be defined within the spec.

< a href =http://dev.w3.org/csswg/css-text-3/#word-break-property =nofollow> http://dev.w3.org/csswg/css-text -3 /#word-break-property

http://dev.w3.org/csswg/css-text-3/#overflow-wrap-property

例如,如果我想要按如何在前标签中换行文本?,一些行包含没有空格的字符串(这似乎使Chrome认为它们是不可破坏的(即使他们有逗号等)) ,我还要使用 word-break:break-all word-wrap:break-word 白空间:预封装

For example, if I want text wrapped as per How do I wrap text in a pre tag?, and some lines contain strings with no spaces (which seems to make Chrome think they're non-breakable (even if they do have commas and such)), do I want to use word-break: break-all or word-wrap: break-word, in addition to white-space: pre-wrap?

推荐答案

:break-all 破解其他行中的句子和文本
word-wrap:break-word`它不打破句子它的断行和全句go to next line without break

word-break: break-allits break the sentence and text in other line word-wrap: break-word` its not break the sentence its break the line and full sentence go to next line without break

p {
	width:100px;
	word-break:break-all;
	padding-left:20px;
}
div {
	width:100px;
	word-wrap: break-word;
	padding-left:20px;
}

<body>
<p>India's Saina Nehwal won the Australian Badminton Open Super Series title at the State Sports Centre in Sydney on 29 June, 2014. Saina began the match in aggressive fashion as she raced into a 12-8 lead in the first game against Spain's Carolina Marin in the final.</p>
<div>India's Saina Nehwal won the Australian Badminton Open Super Series title at the State Sports Centre in Sydney on 29 June, 2014. Saina began the match in aggressive fashion as she raced into a 12-8 lead in the first game against Spain's Carolina Marin in the final. </div>
</body>

这篇关于“word-break:break-all”和“word-wrap:break-word”之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆