2017-04-27 66 views
0

当我的屏幕宽度为682PX时,我的图像宽度未覆盖在屏幕上并开始消失。它显然没有反应,我无能为力。我的视差图像无法响应手机/引导程序

我还为我的部分parrallax添加了一类'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"); 


} 
+0

我不知道,这是你在找什么? https://codepen.io/k185/pen/MmJXOv – k185

+0

是的,确切!图像完全响应。你从我的代码中改变了什么?感谢您的帮助。 – Benjamints

+0

创建一个答案,我会将其标记为正确的。 – Benjamints

回答

0

检查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>

+0

出于某种原因,当我将它应用于我的代码时,我的图像仍然没有响应。 – Benjamints

+0

这没有意义。 – Benjamints

+0

你可以上传你的图像文件 – k185

相关问题