I am trying to center this text character ☢ within a circle. (☢)
While IE 10 displays the text vertically and horizontally centered, both Chrome and Firefox render too much padding at the top.
Any ideas how to fix this? (Flexbox is not a must have)
HTML
<div class="tl-icon">
<div>☢</div>
</div>
CSS
.tl-icon {
align-items: center;
background: black;
border-radius: 50%;
color: yellow;
display: flex;
font-size: 3em;
height: 3rem;
justify-content: center;
width: 3rem;
}
See live demo here: http://codepen.io/dash/pen/ZYePWP
The problem is that the inner child is a text which screws with your height.
I added a line-height
which seems to fix it a bit:
.tl-icon div{
line-height:1px;
}
http://codepen.io/anon/pen/ZYePBZ
Target that child div, set it to inline-block
and change the vertical alignment:
.tl-icon div{
display: inline-block;
vertical-align: top;
}
CODEPEN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With