简体   繁体   English

Fontawesome 5额外的顶部和底部填充

[英]Fontawesome 5 extra top and bottom padding

Is there any way to remove the extra top and bottom padding for Fontawesome 5 icon as shown in the image (after adding a red background color) 有什么方法可以删除Fontawesome 5图标的多余顶部和底部填充,如图中所示(在添加红色背景色之后)

在此处输入图片说明

<i class="fab fa-5x fa-facebook" style="background-color: red;"></i>

Simple fiddle https://jsfiddle.net/68d05etb/15/ 简单的小提琴https://jsfiddle.net/68d05etb/15/

To eliminate extra padding in text/icons you can set a static line-height for the icon. 要消除文本/图标中的多余填充,您可以为图标设置静态line-height

ie if you font-awesome icon is 30px tall but 5px of that is padding then you can do the following: 也就是说,如果你的字体-真棒图标30px高大,但5px的是填充,那么你可以做到以下几点:

i{line-height: 25px;}

Not sure if this is right way to do it, but changing the line-height doesn't work for me. 不知道这样做是否正确,但是更改line-height对我来说不起作用。 I end up creating the same effect I want by using fa-layers 我最终通过使用fa-layers创建了想要的效果

<a href="#" class="fa-layers fa-fw" target="_blank"> <i class="fas fa-square" style="color: #FFFFFF;"></i> <i class="fab fa-facebook" style="color: #3C5995;"></i> </a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM