2017-02-17 59 views

回答

0

您可以直接变换成角度的div并在他们圈关闭屏幕。

<style> 
 
    body { 
 
     margin: 0; 
 
    } 
 

 
    .angle { 
 
     margin: -75px; 
 
     top: 350px; 
 
     height: 400px; 
 
     background: green; 
 
     transform: rotate(-5deg); 
 
     z-index: 5; 
 
    } 
 

 
    .revAngle { 
 
     margin: -75px; 
 
     width: 150%; 
 
     height: 400px; 
 
     background: green; 
 
     transform: rotate(5deg); 
 
     z-index: 5; 
 
    } 
 

 
    .strait { 
 
     height: 500px; 
 
     background: pink; 
 
    } 
 

 
</style> 
 

 
<html> 
 
<div class="strait"></div> 
 
<div class="angle"></div> 
 
<div class="strait"></div> 
 
<div class="revAngle"></div> 
 
<div class="strait"></div> 
 
</html>

http://codepen.io/kevinlbatchelor/pen/ggJmYK

0

要实现沿着这行代码的视差背景效果使用的东西。

例子:

.parallaxdiv { 
    /* The image used */ 
    background-image: url("img_parallax.jpg"); 

    /* The Full height */ 
    height: 100%; 

    /* Create the parallax scrolling effect */ 
    background-attachment: fixed; 
    background-position: center; 
    background-repeat: no-repeat; 
    background-size: cover; 
} 

我不完全相信你的斜边的意思,但你可以尝试使用CSS夹路径,实现了倾斜的影响。

一个例子:

.img { 
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%); 
    clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%); 
} 

请投票,如果它可以帮助!