Yesterday, two roommates asked me such a question, in the box letters or numbers will not automatically wrap, but the Chinese can !!!! What did I say? May not have encountered also do not understand, we directly look at the case:

The code is as follows:

<! DOCTYPEhtml>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Overflow problem resolution</title>
  <style>
    div {
      height: 200px;
      width:200px;
      background-color: orange;
    }
  </style>
</head>
<body>
  <div>1111111111111111111111111111111111</div>
</body>
</html>
Copy the code

The effect is as follows:

Oh my God, I was curious and did a lot of research. I didn’t find any real official understanding, but the problem was solved. Read on.

To explore the

The reason:

I didn’t find it. I think the numbers or letters connected together are treated as a whole when the internal coding is done. When displaying a single whole, it will be displayed according to line elements without line breaks.

To solve

Add one of the following lines to the CSS style.

word-break:break-all; orword-wrap:break-word;
Copy the code

W3cschool:www.w3school.com.cn/cssref/pr_w…