比較長的單詞換行用屬性hyphens:auto
兼容性:https://caniuse.com/#search=hyphens
兩個注意要點:
1.html的lang="en-US"
2.需要設置css的word-break:break-all;
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>hyphens</title>
<style>
.div1 {
width: 100px;
height: 30px;
word-break: break-all;
hyphens: auto;
}
</style>
</head>
<body>
<div class="div1">fasdfasdfasdfsdfasfsdf</div>
</body>
</html>