本文介绍了单词之间的区别:分词和分词:分词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 像大多数人一样,我需要在某个地方修复一些CSS,因为我的文本没有被包裹起来,反而会无限期地继续下去。在我的CSS文件中,我尝试过使用 word-wrap:break-word; ,但它无效。 然后,令我惊讶的是,在Google Chrome Developer Tools的建议下,我尝试了 word-break:break-word; ,它解决了我的问题。我对此感到震惊,所以我一直在Google上搜索以了解这两者之间的区别,但我没有看到这方面的任何内容。 另外,我不认为 word-break:break-word; 是文档化的行为,可以看到 W3 没有提及它。我在Safari和Chrome上测试了它,它对两者都很好,但我对使用 word-break:break-word; 犹豫不决,因为我没有提到它 解决方案 更新 如果你计划打破单词并想要连字符,请尝试以下操作: .hyphenate { overflow-包装:打破字; word-wrap:分词; -webkit-hyphens:auto; -ms-hyphens:auto; -moz-hyphens:auto; 连字符:auto; } 即使在Chrome浏览器中也能正常工作......有点...... sans连字符。无论如何,详细解释请参阅文章 。 word-break:break-word 没有记录,只有主开发者知道这个超级秘密技术,像颤抖的Palm死亡。 实际上,它是一个不起眼的 -webkit - 属性,它的作用类似于 word-wrap:break -word ,但它也用于动态长度。 Kenneth.io - Word使用CSS包装Hypernation CSS-Tricks - word-break 从 $ c> break-word 值被视为 word-wrap:break-word 。 I needed to fix some CSS somewhere because my text wasn't wrapping around and was instead going on indefinitely if it was an extremely long word.Like in most cases, I tried word-wrap: break-word; in my CSS file and it did not work.Then, to my surprise, and by the suggestion of Google Chrome Developer Tools, I tried word-break: break-word; and it fixed my problem. I was shocked by this so I've been googling to know the difference between these two but I have seen nothing on the subject.Further, I don't think word-break: break-word; is documented behavior seeing as how W3 has no mention of it. I tested it on Safari and Chrome, and it works perfectly on both, but I'm hesitant to use word-break: break-word; because I see no mention of it anywhere. 解决方案 UpdateIf you plan on breaking words and want to hyphenate as well, try the following:.hyphenate { overflow-wrap: break-word; word-wrap: break-word; -webkit-hyphens: auto; -ms-hyphens: auto; -moz-hyphens: auto; hyphens: auto;}This worked even in Chrome ... sort of ... sans hyphens. Anyways a detailed explanation is in this article.word-break:break-word is not documented and only master developers know this ultra secret technique like the Quivering Palm of Death.Actually it's an obscure -webkit- property that works like word-wrap: break-word but it's also used on dynamic lengths as well.Kenneth.io - Word Wrapping Hypernation Using CSSCSS-Tricks - word-breakFrom CaniUse: Chrome, Safari and other WebKit/Blink browsers also support the unofficial break-word value which is treated like word-wrap: break-word. 这篇关于单词之间的区别:分词和分词:分词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-24 11:02