简体   繁体   English

Bootstrap背景图片无法在iPhone上调整大小

[英]Bootstrap Background Image not resizing on iPhone

I have created a website that is close to completion using Bootstrap.The problem I am having is that on a desktop or android device it looks great and works as planned. 我创建了一个使用Bootstrap接近完成的网站。我遇到的问题是在台式机或android设备上它看起来不错并且可以按计划工作。 However, on Iphone the background image doesn't shrink to fit the display. 但是,在Iphone上,背景图像不会缩小以适合显示。 The site uses Cascade scrolling. 该网站使用级联滚动。

www.mabmetalworks.com www.mabmetalworks.com

I suspect it has something to do with the iphone being a retina display ? 我怀疑这与iPhone的视网膜显示屏有关吗?

Can you take a look at my code below please and advise how I rectify it to work with iPhone ? 您能否在下面查看我的代码,并建议我如何纠正它才能与iPhone一起使用?

<div id="home" class="home">
  <div class="text-vcenter">
   <h1>MAB Metal Works</h1>
   <h3 class = "H2">Your Local Steel Company</h3>
   <a href="#about" class="btn btn-default btn-lg">Continue</a>
   </div>
 </div>

 #home {
 background: url(../images/main.jpg) no-repeat center center scroll; 
 display: table;
 height: 100%;
 position: relative;
 width: 100%;
 max-width: 100%;
 -webkit-background-size: cover;
 -moz-background-size: cover;
 -o-background-size: cover;
 background-size: cover;
 }

There is also a class specific for images. 还有一个特定于图像的类。

<img class="img-responsive">

You can try this one out. 您可以尝试一下。 I don't if this is your answer. 如果您的答案是我,我不会。

Link to article : http://www.w3schools.com/bootstrap/bootstrap_ref_css_images.asp 链接到文章: http : //www.w3schools.com/bootstrap/bootstrap_ref_css_images.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM