【发布时间】:2021-03-11 11:37:39
【问题描述】:
我的任务是用 html 和 css 重新创建这个模型。在过去的几个小时里,我一直在摆弄试图使用剪辑路径和边框,但我无法实现模型的结果。
给了我2个图片资源,图片不包含文字和按钮。
#index-custom-content {
height: 40rem;
padding-bottom: -20%;
}
#index-custom-content div:nth-of-type(1){
position: relative;
width: 100%;
}
#index-custom-content div:nth-of-type(2) {
clip-path: polygon(0 0, 100% 90%, 100% 100%, 0 10%);
background-color: black;
z-index: 1000;
position: relative;
top: -2em;
}
#index-custom-content div:nth-of-type(3){
position: relative;
top: -20%;
width: 100%;
z-index: -100;
}
<div id="content">
<div id="index-custom-content">
<div><img src="bare-rolig.jpg"></div>
<div>asd</div>
<div><img src="bestseller.gif"> </div>
</div>
</div>
我的问题是,当给定 2 个大小不等的图像(宽度和高度)时,如何实现分隔 2 个图像的对角线。也可以调整大小,比例正确,线条宽度也保持不变。
非常感谢任何建议或正确方向的观点!提前谢谢!
【问题讨论】: