“word

编程入门 行业动态 更新时间:2024-10-27 02:18:36
本文介绍了“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.

dev.w3/csswg/css-text -3 /#word-break-property

dev.w3/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

本文发布于:2023-11-23 19:30:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622619.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:word

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!