gpt4 book ai didi

html - 带白色边框的三 Angular 形

转载 作者:可可西里 更新时间:2023-11-01 14:53:11 26 4
gpt4 key购买 nike

如何使用 CSS 创建带有白色边框的三 Angular 形?如下图所示。

enter image description here

当我添加这个css时

.triangle {
width:0;
height:0;
border-top: 20px solid transparent;
border-left: 20px solid white;
border-bottom: 20px solid transparent;
position:relative;

}
.triangle:before {
content:'';
width:0;
height:0;
border-top: 10px solid transparent;
border-left: 10px solid red;
border-bottom: 10px solid transparent;
position:absolute;
top:-10px;
left:-17px;
}

结果是

enter image description here

最佳答案

CSS:

.triangle {
width:0;
height:0;
border-top: 20px solid transparent;
border-left: 20px solid white;
border-bottom: 20px solid transparent;
position:relative;

}
.triangle:before {
content:'';
width:0;
height:0;
border-top: 10px solid transparent;
border-left: 10px solid red;
border-bottom: 10px solid transparent;
position:absolute;
top:-10px;
left:-17px;
}

HTML:

<div class="triangle"></div>

Fiddle

关于html - 带白色边框的三 Angular 形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14909212/

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