如何打破HTML中的单词等小数?

时间:2015-07-21 12:29:43

标签: javascript jquery html css

我想用点和逗号来打破数字,就像我分手一样。我该怎么办?

提前致谢

“活得长久而繁荣”

div {
  border: 1px solid red;
  max-width: 50px;
  word-break: break-all;
}
<!DOCTYPE html>
<html>

<head>
  <title>HTML5, CSS3 and JavaScript demo</title>
</head>

<body>
  <div>3.0.0.1.2.3.1.2.3</div>
  <div>Beam me up scotty!</div>
</body>

</html>

1 个答案:

答案 0 :(得分:5)

您需要使用word-wrap:break-word DEMO

div {
  border: 1px solid red;
  max-width: 50px;
  word-break: break-all;
  word-wrap: break-word;
}