html - 超大屏幕背景图片没有响应

标签 html css twitter-bootstrap background-image

当我在桌面上查看页面时,它工作正常并且图像响应迅速。当我直接在 iPhone 上查看页面时,图像不正确。

Screenshots of the jumbotron image on a PC and on a phone. The image shows a man in the PC version but the phone shows a blurry close up of the brick wall behind him.

Index.html

  <header>
    <div class="jumbotron">
      <div class="container" id="maincontent" tabindex="-1">
        <div class="row">
            <div class="col-lg-12">
                <div class="intro-text">
                    <h1 class="name">Headline</h1>
                    <hr class="star-light">
                    <span class="skills">Sub-header</span>
                </div>
            </div>
        </div>
    </div>
  </div>
</header>

Style.css (freelance.css)

.jumbotron {
  background: url("http://vlastapolach.cz/img/expecto.jpg") no-repeat fixed;
  background-size: cover;
  background-position: top center;
  height: auto;
}

完整代码在这里:https://github.com/vlastapolach/portfolio

我已经尝试过这些,但它在桌面上也无法正常工作。

background-size: contain;
background-size: auto;
background-size: 100% 100%;

最佳答案

速记语法将 background-size 固定。我已经删除了固定的。

.jumbotron {
  background: url("http://vlastapolach.cz/img/expecto.jpg") no-repeat;
  background-size: cover;
  background-position: top center;
  height: auto;
  width:100%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
  <header>
    <div class="jumbotron">
      <div class="container" id="maincontent" tabindex="-1">
        <div class="row">
            <div class="col-lg-12">
                <div class="intro-text">
                    <h1 class="name">Headline</h1>
                    <hr class="star-light">
                    <span class="skills">Sub-header</span>
                </div>
            </div>
        </div>
    </div>
  </div>
</header>

关于html - 超大屏幕背景图片没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43808272/

相关文章:

html - 如何使 Bootstrap 容器自动调整高度?

html - 内联样式不会覆盖

html - 裁剪图像并显示所有具有相同高度的图像

html - Div 应该是它的 child 的宽度,而另一个 child 应该换行

php - 在 Symfony 4/Twig 模板中包含资源(CSS、JS)

css - 响应式 Css float DIV 在调整窗口大小时无法正常工作

javascript - 单击添加元素并单击删除相同的元素

Jquery动态图像调整大小不正确的图像尺寸

jQuery、Smarty、CSS、HTML - 两个列表 <UL>,以几种不同的方式管理

javascript - Bootstrap Row 从边缘开始