div中的width = 100%并不能让它响应

时间:2017-11-03 10:26:13

标签: html

嘿所以我正努力让我的订阅者区域响应。为整个区域创建了一个div容器。但设置宽度= 100%并不会使区域响应。

<meta name="viewport" content="width=device-width, initial-scale=1.0"> 
<div style= "width:100%; height:auto; border-radius:4px; background-color:#36424d; margin-top:0px; margin-bottom:0px; padding-top:40px; padding-bottom:40px; padding-left:40px; padding-right:40px;">
    <h2 style="color:#ffffff;"><b><center>Get actionable influencer marketing advice. Delivered weekly.</center></b></h2>
    <h3 style="color:#ffffff"><center>Join 6308 good looking people who get our latest content first.</center></h3>     
  <br/>
    <div style= "background-color:#dee5e5; border-radius:3px; padding-left:10px; padding-right:10px">
    <input type="email" name="EMAIL" placeholder="Your business/personal email address" required />
    </div>  

    <div style="text-align: center;">
    <input type="submit" value="Subscribe" />
    </div>
</div> 

2 个答案:

答案 0 :(得分:0)

你需要删除宽度OR以添加内部div并在那里填充

&#13;
&#13;
<div style= "width:100%; height:auto; border-radius:4px; background-color:#36424d; margin-top:0px; margin-bottom:0px; padding-top:40px; padding-bottom:40px;">
<div style=" padding-left:40px; padding-right:40px;">
    <h2 style="color:#ffffff;"><b><center>Get actionable influencer marketing advice. Delivered weekly.</center></b></h2>
    <h3 style="color:#ffffff"><center>Join 6308 good looking people who get our latest content first.</center></h3>     
  <br/>
    <div style= "background-color:#dee5e5; border-radius:3px; padding-left:0px; padding-right:0px">
    <input type="email" name="EMAIL" placeholder="Your business/personal email address" required style="width:100%;height:32px;border-radius:3px;" />
    </div>  

    <div style="text-align: center;">
    <input type="submit" value="Subscribe" style="margin:5px auto; border-radius:3px;" />
    </div>
    </div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

设置宽度= 100vw为我完成了这项工作。您可以根据需要将其设置为任何其他数字。

<div style= "width:96vw; height:auto; border-radius:4px; background-color:#36424d; 
             padding-top:40px; padding-bottom:40px; 
             padding-left:40px; padding-right:80px;">