2017-02-17 68 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%); 
} 

請投票,如果它可以幫助!