html - 我的视差图像对移动设备/Bootstrap 没有响应

标签 html css twitter-bootstrap

当我的屏幕宽度为 682PX 时,我的图像宽度没有覆盖在屏幕上,它开始消失。它显然没有响应,我不知道为什么。

我还在视差部分加入了一类“img-responsive”。这也没有用。

<section class="module parallax parallax-1" class="img-responsive">
  <div class="container">
    <h1>Services</h1>
  </div>
</section>

<section class="module content">
  <div class="container">
    <h2>Lorem Ipsum Dolor</h2>
      <p></p>
  </div>
</section>
</div> 

CSS:

section.module:last-child {
  margin-bottom: 0;
}
section.module h2 {
  margin-bottom: 40px;
  font-family: "Roboto Slab", serif;
  font-size: 30px;
}
section.module p {
  margin-bottom: 40px;
  font-size: 16px;
  font-weight: 300;
}
section.module p:last-child {
  margin-bottom: 0;
}
section.module.content {
  padding: 40px 0;
  height: 600px;
}
section.module.parallax {
  height: 600px;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover !important; 
  margin-top: -30px;
}
section.module.parallax h1 {
  color: rgba(255, 255, 255, 0.8);
  font-size: 48px;
  line-height: 600px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

section.module.parallax-1 {
  background-image: url("../img/rolling.jpg");


}

最佳答案

检查 section.module.parallax-1 部分,我已经为这个类添加了背景功能。还删除了 section.module.parallax 类,因为它与结果有冲突,这是有问题的

section.module:last-child {
  margin-bottom: 0;
}
section.module h2 {
  margin-bottom: 40px;
  font-family: "Roboto Slab", serif;
  font-size: 30px;
}
section.module p {
  margin-bottom: 40px;
  font-size: 16px;
  font-weight: 300;
}
section.module p:last-child {
  margin-bottom: 0;
}
section.module.content {
  padding: 40px 0;
  height: 600px;
}

section.module.parallax h1 {
  color: rgba(255, 255, 255, 0.8);
  font-size: 48px;
  line-height: 600px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

section.module.parallax-1 {
  background-image: url("https://image.ibb.co/dquSd5/rolling.jpg");
  background-repeat:no-repeat;
background-size:contain;
  background-size: 100%;
top: 0;


}
<section class="module parallax parallax-1 img-responsive">
  <div class="container">

    <h1>Services</h1>
  </div>
</section>

<section class="module content">
  <div class="container">
    <h2>Lorem Ipsum Dolor</h2>
      <p></p>
  </div>
</section>
</div> 

关于html - 我的视差图像对移动设备/Bootstrap 没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43657091/

相关文章:

jquery - 在 Twitter Bootstrap 导航栏中将所有元素对齐在一个水平行中

javascript - 对象不支持属性或方法 'remove'

javascript - jquery插件mmenu如何跳转到某个元素id

javascript - 裁剪和保持宽高比时适合的 CSS/Javascript 图像大小

css - 缺少 Bootstrap 下拉子菜单

javascript - Bootstrap 按钮复选框

php - 尝试更改从 mySQL 数据库导入的 HTML 元素的背景颜色时,PHP 中的非更新内联 CSS

html - 没有js的固定纵横比和固定高度的元素

html - 禁用 Gmaps 拖动,启用页面滑动?

javascript - 不引人注目地设置属性后功能失败