gpt4 book ai didi

html - 仅使用 CSS/HTML 创建金字塔形状

转载 作者:太空狗 更新时间:2023-10-29 13:39:25 25 4
gpt4 key购买 nike

我正在尝试在 CSS 中创建一个类似金字塔的形状。 我正在使用我在互联网上读到的一种方法来做到这一点,当您将 Div 的宽度设置为 0 px 时,它的边框将连接起来创建 4 个三 Angular 形。但是我想移除/切割尖头金字塔和我一直做不到。我尝试用其他 DIV 隐藏提示,但这看起来不正确。

现在的形状:以下是我到目前为止所做的。

enter image description here

要求的形状:我想做的是这样的形状:

enter image description here

这是我的代码:

#pyramid {
width: 0px;
border-left: 20px dotted transparent;
border-right: 20px solid transparent;
border-bottom: 50px solid blue;
}
<div id="pyramid"></div>

最佳答案

为您的 div 添加任意宽度即可。这样做,您实际上将拥有 3 个相连的图形:中间有 2 个三 Angular 形和 1 个矩形。

#pyramid {
width: 5px;
border-left: 20px dotted transparent;
border-right: 20px solid transparent;
border-bottom: 50px solid blue;
}
<div id="pyramid"></div>

关于html - 仅使用 CSS/HTML 创建金字塔形状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39202627/

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