首页 > 解决方案 > HTML代码中的自动换行属性问题

问题描述

有谁知道为什么“自动换行”在下面的 html 代码中不起作用?

<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /><meta name=\"viewport\" content=\"width=341.0px, minimum-scale=1, word-wrap=break-all, maximum-scale=1, user-scalable=no, shrink-to-fit=no\" /></head><body style=\"-webkit-text-size-adjust:none\  ">HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello</body></html>

标签: htmlcss

解决方案


您必须word-wrap: break-word; 在 body 标签中使用 CSS。

<html>

<head>
  <meta http-equiv=\ "content-type\" content=\ "text/html; charset=UTF-8\" />
  <meta name=\ "viewport\" content=\ "width=341.0px, minimum-scale=1, word-wrap=break-all, maximum-scale=1, user-scalable=no, shrink-to-fit=no\" />
</head>

<body style="word-wrap: break-word; ">HelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHelloHello</body>

</html>


推荐阅读