我想在截面底部做一个三角形。但它不是响应方式......当我调整窗口大小时,:before 和 :after 之间的空间越来越大。
如何用另一种方式制作它?
JSFIDDLE 演示:http: //jsfiddle.net/0y4L7hxh
<section id="s1">
<h1>Hello World !</h1>
</section>
<section id="s2">
<h1>Hello Dominik !</h1>
</section>
#s1 {
background-color: green;
padding: 160px 0px;
}
#s2 {
background-color: #330099;
padding: 160px 0px;
}
#s1:before {
position: absolute;
content:"";
bottom: 40px;
width: 51%;
height: 150px;
left: 0;
background-color: green;
transform: rotate(8deg);
z-index: 9999;
}
#s1:after {
position: absolute;
content:"";
bottom: 40px;
width: 51%;
height: 150px;
right: 0px;
background-color: green;
transform: rotate(-8deg);
z-index: 9999;
}