gpt4 book ai didi

html - 有没有一种简单的方法可以为 HTML
制作自定义边框形状?

转载 作者:行者123 更新时间:2023-11-28 16:16:16 24 4
gpt4 key购买 nike

我正在构建一个网页,其中的卡片排列成网格。

但是,我希望我的卡片具有独特的形状,而不仅仅是矩形。我希望它们的形状是马尼拉文件夹的形状(如下图)

有没有相对简单的方法来制作这种形状的div?

folder

最佳答案

这是一个只使用 html 和 css 的开始:

body {
padding: 50px;
}

div {
position: relative;
z-index: 1;
white-space: nowrap;
}

div .slant {
position: relative;
display: inline-block;
color: inherit;
text-decoration: none;
margin: 0 -14px -4px;
width: 40px;
}

div .slant::before,
main {
border: 0.2em solid #000;
background: #000;
}

div .slant::before {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0.5em;
left: 0;
z-index: -1;
border-bottom: none;
border-radius: 5px 5px 0 0;
background: #000;
transform: perspective(5px) rotateX(2deg);
transform-origin: bottom;
}

div.left .slant {
padding: 1.5em 2em 1em 1em;
}

div.left .slant::before {
transform-origin: bottom left;
}

main {
display: block;
margin: -8px 0 30px -14px;
padding: 1em;
border-radius: 0 5px 5px 5px;
width: 200px;
height: 300px;
}
<div class="left">
<div class="slant"></div>
</div>
<main>
</main>

关于html - 有没有一种简单的方法可以为 HTML <div> 制作自定义边框形状?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58741981/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com