inline svg .
, 100%, CSS preserveAspectRatio svg attribute,
40 , rezise , CSS preserveAspectRatio.
.top {
position:relative;
background-color: green;
height: 100px;
width: 100%;
}
.bottom {
background-color: red;
height: 200px;
width: 100%;
}
.triangle {
position:absolute;
top:100%;
width:100%;
height:40px;
}
<div class="top">
<svg viewbox="0 0 100 10" preserveAspectRatio="none" class="triangle" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<polygon points="0 0 100 0 50 10"/>
</svg>
</div>
<div class="bottom"></div>
Hide result( , , ...), CSS, SVG. CSS:
.top {
position: relative;
background-color: green;
height: 100px;
width: 100%;
}
.bottom {
background-color: red;
height: 200px;
width: 100%;
}
.triangle {
position: absolute;
top: 100%;
width: 100%;
height: 40px;
fill: gold;
}
<div class="top">
<svg class="triangle" viewbox="0 0 100 10" preserveAspectRatio="none" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<polygon points="0 0 100 0 50 10" />
</svg>
</div>
<div class="bottom"></div>
Hide result