I have a list that uses font awesome, hence its class is fa-ul
:
<ul class='fa-ul'>
<li class='dept'><i class='fa-li fa fa-stop'></i><span>Management</span></li>
<li class='dept'><i class='fa-li fa fa-stop'></i><span>Something else</span></li>
</ul>
The associated CSS is :
li {
font-size : 2em;
margin: 1em 0;
}
I'd like the text and the stop-square to be vertically aligned. So far, it is not the case :
See screenshot:
I've tried to wrap the fa-icon and the text in a <div>
element with vertical-align
property set to middle
, without success. Thanks for helping me.
Use inline-blocks
and do vertical-align: middle
to make it right.
li {
font-size : 2em;
margin: 1em 0;
}
li > *{
display: inline-block;
vertical-align: middle;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
<ul class='fa-ul'>
<li class='dept'><i class='fa-li fa fa-stop'></i><span>Management</span></li>
<li class='dept'><i class='fa-li fa fa-stop'></i><span>Something else</span></li>
</ul>
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