I'm using the plus icon (font awesome) and it's not centered properly in the blue circle for different browsers (Chrome Version 69.0.3497.92, Firefox 62, and Safari 11.1.2).
It's been bothering me for a while and I can't seem to find what the issue is. It also seems to shift when you're zooming in and out (command + plus or minus)
Any insight would be helpful!
Codepen: https://codepen.io/anev-prud/pen/oPQzXJ
Thanks!
Other things to note:
I'm using flex box to center things (vertically and/or horizontally)
Using bootstrap classes
=======================
Code from Codepen
HTML
<div class="container mt-5">
<div class="row">
<!-- button 1 -->
<div class="col-md-4 mb-5 d-flex flex-column align-items-center">
<h3>button 1</h3>
<button class="btn btn-link btn-3 p-0 d-flex flex-column align-items-center">
<div class="addToFav d-block mb-2">
<i class="fa fa-plus"></i>
</div>
<div class="fav-text d-block">
Favorites
</div>
</button>
</div>
<!-- button 2 -->
<div class="col-md-4 mb-5 text-center d-flex flex-column align-items-center">
<h3>button 2</h3>
<button class="btn btn-link btn-3 p-0 d-flex flex-row align-items-center">
<div class="addToFav d-inline-block">
<i class="fa fa-plus"></i>
</div>
<div class="fav-text d-inline-block ml-2">
Favorites
</div>
</button>
</div>
</div>
</div>
CSS
// main css
.addToFav {
position: relative;
font-size: 15px;
color: #fff;
.fa {
padding: 0.2em 0.71em;
background: blue;
border-radius: 50rem;
display: inline;
// font-size: 50px;
&::before {
position: absolute;
opacity: 1;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
}
}
// on hover, remove underline under + icon
.btn:hover {
text-decoration: none;
}
.btn:hover .fav-text {
text-decoration: underline;
}