【问题标题】:Issue with word-wrap property in HTML code [duplicate]HTML代码中的自动换行属性问题[重复]
【发布时间】:2020-12-19 06:09:02
【问题描述】:

有谁知道为什么“自动换行”在下面的 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>

【问题讨论】:

    标签: html css


    【解决方案1】:

    你必须在body标签中使用word-wrap: break-word; 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>

    【讨论】:

    • 我们不能在正文中也保留 style=\"-webkit-text-size-adjust:none\ 吗?
    • 是的,你可以保留它
    • 我想保留这两个属性。但是当我尝试添加相同的内容时,它就不起作用了。
    • 因为您可以在 css 中使用 \,这是错误的。您可以不使用 \.
    猜你喜欢
    • 1970-01-01
    • 2023-03-10
    • 2023-03-29
    • 1970-01-01
    • 2011-03-13
    • 2015-02-02
    • 2021-10-08
    • 1970-01-01
    • 2013-09-07
    相关资源
    最近更新 更多