Text (numbers and very long English words) force a line break at the end

Key statement:

word-wrap:break-word;

word-break:break-all;


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />  
<title>换行</title>
</head>
<style>
.box1{
    width: 200px;
    border:1px solid red;
    font-size: 18px;
    word-wrap:break-word; 
    word-break:break-all;

}
</style>
<body>
    <div class="box1">我是一行很长额文字hello goto 192321245956588654868 lalallaallalallaall</div>
</body>
</html>

Guess you like

Origin blog.csdn.net/spring_007_999/article/details/126721145