为什么我在You后面加上连字符后You后面的字体没有换行?

来源:1-5 换行(word-break和word-wrap)

大白前端

2020-02-16 16:11:48

<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <title>background-origin</title>

        <style type="text/css">

            div{

            width: 200px;height: 1000px;border: 1px solid red;

            word-break:keep-all;

            }

        </style>

    </head>

    <body>

     <div>You-know that sleep is vital to your physicaland mental health. But, how can you tell whether you’re truly sleeping well? Especially if you work shifts, your sleep probably does not look exactly like other peoples’ sleep. It can be hard to measure your sleep patterns against those of the people around you.  </div>

     

    </body>

</html>


写回答

1回答

好帮手慕糖

2020-02-16

同学你好,不是所有的连字符都会换行的,是这一行存放不下了,而正好又有连字符才会换行,显示这里能存放得下,所以是不会换行的。

我们可以换个来测试下,如下,peoples’因为存放不下,到下一行去了,

http://img.mukewang.com/climg/5e4901d40925d70002270220.jpg

而这里我们添加个连字符的话,就不用全部到下一行了,例:

http://img.mukewang.com/climg/5e490212097f798904330070.jpg

http://img.mukewang.com/climg/5e49021f0966e4df02310067.jpg

如果我的回答帮助了你,欢迎采纳,祝学习愉快~

0

0 学习 · 40143 问题

查看课程