webView 隐藏内容 swift

webView hiding content in swift

我创建了一个 html 模板,我说它的宽度为 100%,但它似乎仍然隐藏了屏幕右侧的内容。该模板应该使用 webView 嵌入到 ios 应用程序中。您可以在下面看到它的外观:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <style type="text/css">
        body{
            font-family: 'PT Sans';
            margin-left:0;
            margin-right:0;
            margin-top: 0;
            width   100%;
        }
        .title_div{
            padding-left:5px;
            padding-right:5px;
            font-size:16px;
            width: 100%;
            word-wrap: break-word;

        }

    .title_div p {
         display: block;
    }
    h3{
        font-size: 26px;
        padding-left:5px;
        word-wrap: break-word;
          margin-top: 5px;
    }
    .main_image {
        width: 100%;
        height: 200px;
        background-size: cover;
    }
    .main_image img{
        width: auto;
        height: auto;

    }
    </style>
</head>
<body>

   <div class="main_image" style="background-image:url([[[main_image]]])" title="[[[alt_desc]]]"></div>
   <h3>[[[title]]]</h3>
   <div class="title_div">
        <p>[[[full_text]]]</p>
   </div>
</body>
</html>

尝试将 webviews scalesPageToFit 属性 设置为 YES!