换行的规则怎么在google浏览器和火狐里显示不一样呢?

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

怒焰狂暴

2020-02-17 11:50:20

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Document</title>

  <style>

    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 li-keother peo-ples’ sleep. It can be hard to measure your sleep patterns against those of the people around you.  </div>

</body>

</html>


写回答

2回答

好帮手慕慕子

2020-02-17

同学你好, 这个是浏览器自身解析的差异造成的效果,同学不用纠结,简单了解下word-break:keep-all;属性即可。

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

0

怒焰狂暴

提问者

2020-02-17

在火狐浏览器里,keep-all的规则好像不起作用

0

0 学习 · 40143 问题

查看课程