CSS word-break属性,指定换行规则

word-break属性

CSS中的word-break属性,可以用于设置文本换行的规则,比如在文本需要换行的时候,是否将在任何字符处中断,或不中断,如下方示例:

SplitAfter slices s into all substrings after each instance of sep and returns a slice of those substrings.If s does not contain sep and sep is not empty, SplitAfter returns a slice of length 1 whose only element is s.

If sep is empty, SplitAfter splits after each UTF-8 sequence. If both s and sep are empty, SplitAfter returns an empty slice.It is equivalent to SplitAfterN with a count of -1.


可选属性值

keep-all;break-all


word-break属性实例代码,及在线编辑器

<p id='p'>Index returns the index of the first instance of substr in s, or -1 if substr is not present in s.</p>
<style>
  #p{width:100px;word-break:keep-all;border:1px solid grey;}
</style>

全栈前端 / CSS教程 :



























Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.