【发布时间】:2019-03-23 02:19:06
【问题描述】:
我正在尝试创建一个带有梯形形状的网页布局,如附图所示。此外,每个部分都有一个background-image,用cover 或类似结果填充背景。
第一部分(深蓝色)我仅使用skew 和两个 div 就实现了,如下所示。
但是,我无法创建以下部分,它会以两种方式倾斜。我曾尝试使用clip-path,但没有运气。然后最后一部分需要再次进行调整。
HTML
<section id="my_section">
<div id="my_section_bg"></div>
<div id="my_section_content">
<!-- any typical content, text/images here -->
</div>
</section>
CSS
#my_section {
padding-top: 80px;
padding-bottom: 90px;
background-color: rgba(74,90,119,.5);
transform: skewY(-4deg);
}
#my_section_bg {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-image: linear-gradient(
to bottom,
rgba(29,44,71,.85) 0%,
rgba(29,44,71,1) 100%
), url("./assets/my_bg_img.jpeg");
background-color: rgba(29,44,71,1);
transform: skewY(8deg);
}
#my_section_content {
transform: skewY(4deg);
}
【问题讨论】:
-
(我们不鼓励问候、希望你能帮助、谢谢、提前感谢、感谢信、问候、亲切的问候、签名、请你帮忙、闲聊材料和缩写txtspk,恳求,你被困了多久,投票建议,元评论等。只需解释你的问题,并展示你尝试过的,你期望的,以及实际发生的事情。)按照注释on this deleted question .
标签: html css background-image css-transforms clip-path