gpt4 book ai didi

css - 如何垂直放置字体超棒的箭头图标中心

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

.btnup, .btndown{
display:inline-block;
font-size:20px;
background:#ddd;
border-radius:5px;
cursor:pointer;
width:25px;
line-height:30px;
height:30px;
color:#999;
text-align:center;
margin:0 5px;
}
    <link href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" rel="stylesheet"/>

<i class="fas fa-angle-up btnup" id='btnup'></i>
<i class="fas fa-angle-down btndown" id='btndown'></i>

如何让箭头垂直居中?

最佳答案

您可以添加顶部和底部填充(并从 height 设置中减去这些值):

.btnup, .btndown{
display:inline-block;
font-size:20px;
background:#ddd;
border-radius:5px;
cursor:pointer;
width:25px;
line-height:30px;
height:20px;
color:#999;
text-align:center;
margin:0 5px;
padding: 5px 0 5px 0;
}
<link href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" rel="stylesheet"/>

<i class="fas fa-angle-up btnup" id='btnup'></i>
<i class="fas fa-angle-down btndown" id='btndown'></i>

关于css - 如何垂直放置字体超棒的箭头图标中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52896209/

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