Align material icon with text on Materialize
Simply adjust the vertical-align:
into negative value.
sample code:
<i class="material-icons" style="vertical-align: -6px;">folder</i>
I had the same issue for the longest time but found a solution that worked for me. First, give a custom class to the icon you want to center. Then, add a bottom vertical align and a font-size that matches or is smaller than the text it is placed next to. Also, don't specify icon size in the icon classname. Let me know if this works for you.
CSS:
.inline-icon {
vertical-align: bottom;
font-size: 18px !important;
}
HTML:
<p>"Your text goes here"<i class="inline-icon material-icons">warning</i></p>
That's one way to do it. Of course it depends on the icon, you have to find the specific font-size
that will fit the icon's height. Examples:
#txt1{
font-size:28px;
line-height:24px;
}
#txt2{
font-size:36px;
line-height:24px;
}
#txt3{
font-size:21px;
line-height:24px;
}
.material-icons{
display: inline-flex;
vertical-align: top;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<span id="txt1">ID</span><i class="material-icons">info_outline</i>
</br>
<span id="txt2">ID</span><i class="material-icons">settings_cell</i>
</br>
<span id="txt3">ID</span><i class="material-icons">stay_primary_landscape</i>