<div class="contents">
<div class="contents1">
<p>コンテンツ1</p>
</div>
<div class="contents2">
<p>コンテンツ2</p>
</div>
<div class="contents3">
<p>コンテンツ3</p>
</div>
</div>
.contents1 {
background-color: #FFD500;
color: #000;
padding: 60px 30px 120px;
}
.contents2 {
background-color: #000;
color: #FFD500;
padding: 60px 30px;
position: relative;
z-index: 0;
}
.contents3 {
background-color: #FFD500;
color: #000;
padding: 120px 30px 60px;
}
.contents2::before {
/* 上の斜め */
content: '';
display: block;
/* 斜めの調整 */
border-top: 60px solid transparent;
border-right: 100vw solid #000;
border-bottom: 60px solid #000;
border-left: 100vw solid transparent;
/* 斜めの位置の調整 */
position: absolute;
z-index: -1;
left: 0;
top: -120px;
}
.contents2::after {
/*下の斜め */
content: '';
display: block;
/* 斜めの調整 */
border-top: 60px solid #000;
border-right: 100vw solid transparent;
border-bottom: 60px solid transparent;
border-left: 100vw solid #000;
/* 斜めの位置の調整 */
position: absolute;
z-index: -1;
right: 0;
bottom: -120px;
}
This Pen doesn't use any external JavaScript resources.