If you inspect the icon height it's 16px, but for some reason the parent container is 18px.
I've been playing with the css trying to figure why this happens, no luck. Probably something stupid.
PD: No hacks... I know I can force the height on the container, but I don't want to. I just want to understand what's generating the extra pixels.
.container {
background-color: green;
}
i {
background-color: pink;
display:inline-block;
margin:0;
padding:0;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<div class="container">
<i class="fas fa-angry"></i>
</div>
I have also checked this question: Image inside div has extra space below the image but it doesn't seems to fix the issue when adjusting vertical-align
(the display:block
fixes the issue but I don't want to make the icon a block element since it need to go with text)
.container {
background-color: green;
}
i {
background-color: pink;
display:inline-block;
margin:0;
padding:0;
vertical-align:top;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<div class="container">
<i class="fas fa-angry"></i>
</div>