gpt4 book ai didi

javascript - 如何在CSS中创建向下/向上箭头

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

如何在 css 中创建向下/向上的箭头?

我尝试从 div 构建它:

.triangle_down {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid #2f2f2f;
font-size: 0;
line-height: 0;
float: left;
}

这是结果:enter image description here .

但我试图构建这样的东西:enter image description here

有什么建议吗?

最佳答案

我的建议是:

.triangle_down {
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 15px solid #2f2f2f;
font-size: 0;
line-height: 0;
float: left;
}
.triangle_down1 {
position: relative;
top: -5px;
content: "";
display: inline-block;
width: 15px;
height: 15px;
border-right: 0.2em solid black;
border-top: 0.2em solid black;
transform: rotate(135deg);
margin-right: 0.5em;
margin-left: 1.0em;
}
.triangle_up1 {
position: relative;
top: -5px;
content: "";
display: inline-block;
width: 15px;
height: 15px;
border-right: 0.2em solid black;
border-top: 0.2em solid black;
transform: rotate(-45deg);
margin-right: 0.5em;
margin-left: 1.0em;
}
<div id="dialog1" class="triangle_down"></div>
<div id="dialog2" class="triangle_down1"></div>
<div id="dialog3" class="triangle_up1"></div>

关于javascript - 如何在CSS中创建向下/向上箭头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34623447/

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