douxunwei8259 2013-12-01 04:43
浏览 62

iPhone Div背景图像居中?

I'm having a problem with my site's footer.

As you can see on your iPhone (in Safari) the footer image is not displaying correctly and spanning the site's width.

This is the code for the footer:

.footer {
  width: 100%;
  height: 118px;
  background: #000000 url(../images/footer.png) top center !important;
  margin: 70px auto 0 auto;
}
<div class="footer">
  <div style="width:1100px;height:118px;margin:auto;">
    <div id="mc_embed_signup">
      <form action="http://SaveWithPride.us7.list-manage.com/subscribe/post?u=0beccc5a2d913b0527a748edc&amp;id=cb6e398bc5" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
        <input type="email" value="" name="EMAIL" class="email footer-field" id="mce-EMAIL" placeholder="enter your text" onfocus="this.placeholder = ''" onblur="this.placeholder = 'enter your text'" required>
        <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button footer-submit"></div>
      </form>
    </div>
    <div style="width:334px;height:118px;float:right;background:transparent;">
      <div class="socialtext">save with pride, socially:</div>
      <div class="twitter"></div>
      <div class="facebook"></div>
      <div class="footertext">© 2013 SaveWithPride.com&nbsp&nbspAll Rights Reserved.&nbsp&nbsp<a href="adamdworak.com">Design by A/D</a></div>
    </div>
  </div>
</div>

What am I doing wrong here? The footer background (as it appears now) does not stretch to the edge of the browser on iPhone and seems like its not centered. I am trying to get it centered and at 100% width as it shows on my computer.

</div>
  • 写回答

2条回答 默认 最新

  • dougou1943 2013-12-01 05:56
    关注

    So the footer element background is not as wide as the screen? Try adding this:

    .footer {
        background-size: 100% 100%; /* stretches background */
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭