Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align material icon with text on Materialize

Recently, i started working on a project that contains a table with some fields, and I want to add some Material Design Icons trough MaterializeCSS on the side of the icons. Look at the image and you might get it

:example

I tried everything, vertical align, inline(-block), flex, and everything I could find in stack overflow. So no, it's not a duplicate, I really need help. Thank you.

like image 806
MucaP Avatar asked Oct 06 '16 23:10

MucaP


People also ask

How do I make material icon and text in the same line?

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.

How do you center contents in materialize?

You can center the button using materialize class center-align, but use it on <p> or <div> tag. since <a> tag is inline-block tag.

How do you center a div in materialized?

use margin-top, margin-bottom to align the box at center.

Are material icons SVG?

Material icons are also available as regular images, both in PNG and SVG formats.


1 Answers

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> 
like image 198
darkknightsds Avatar answered Sep 20 '22 13:09

darkknightsds