gpt4 book ai didi

html - 我可以在三 Angular 形 div 中放置一个超棒的字体图标吗?

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

enter image description here我用边框画了一个三 Angular 形的 div,我不能流动图标让它在 div 里面吗?

div#sub-footer div {
border-color: transparent transparent #2BD5B4 transparent;
border-style: solid;
border-width: 0px 30px 30px 30px;
margin-bottom: -0.5px;
display: inline-block;
text-align: center;
}

div#sub-footer div a {
float: left;
}

div#line {
width:100%;
border-bottom: 1px solid #394C5F;
margin-bottom: 15px;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div>
<a href="#"><i class="fa fa-arrow-up"></i></a>
</div>

最佳答案

您可以将任何内容放入 div 并使其看起来像一个三 Angular 形。在这里,我从容器 div 中删除了边框,并将透明边框三 Angular 形技巧应用于该容器 div 上的伪元素 (.triangle:before)。使用绝对居中使图标居中,但您也可以轻松地使用 flexbox 或其他技术来实现居中布局。

.triangle {
display: block;
position: relative;
height: 40px;
width: 60px;
}
.triangle:before {
content: '';
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-bottom: 40px solid #2BD5B4;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}

.triangle a {
display: block;
text-align: center;
height: 20px;
width: 20px;
position: absolute;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 2;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="triangle">
<a href="#"><i class="fa fa-arrow-up"></i></a>
</div>

关于html - 我可以在三 Angular 形 div 中放置一个超棒的字体图标吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55348489/

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