I'm trying to center align font awesome icons center by vertically. If there is text we can do it using line-height
property even i tried giving the line-height
same height as height of the div.
Tried display:inline-block
and vertical-align:middle
didn't do the trick.
How to center the icons vertically in all size. It should be dynamic because the icon size may differ. So a hardcode of margin-top may won't work for other size of icon as well div.
CODE
.exp{
width:80px;
height:80px;
background-color:red;
border-radius:100%;
line-height:80px;
text-align:center;
vertical-align:middle;
display:inline-block;
}
JSFIDDLE
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…