请看下面的附图.我想用纯css来保存它.这意味着我只在寻找一个只有css的解决方案.
使用这段css代码,我可以根据需要获得中间行(查看图像).但不适用于顶排和底排.问题是倾斜Angular 不像图像一样对齐.
.slider-single {
position: relative;
background: #f5f5f5;
padding-top: 70px;
padding-bottom: 70px;
}
.slider-single::before {
content: "";
position: absolute;
background: #0072c6;
width: 100%;
height: 100%;
right: 0;
top: 0;
transform: skewX(-16deg) translateX(-50%);
z-index: -1;
}
.skew-bar-top {
position: absolute;
height: 40px;
background: red;
width: 100%;
top: 0;
left: 0;
}
.skew-bar-top::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: #21255d;
transform: skewX(-16deg) translateX(-50%);
}
<div class="slider">
<div class="slider-single with-bg img">
<div class="skew-bar-top"></div>
<div class="container">
<div class="row align-items-center">
<div class="col-md-6 col-lg-6">
-- contents
</div>
<div class="col-md-6 col-lg-6">
-- contents
</div>
</div>
</div>
<div class="skew-bar-bottom"></div>
</div>
</div>