Components: How to align md-icon with text

Created on 14 Sep 2017  路  6Comments  路  Source: angular/components

When I tried to put a text next to an icon, I have an alignment problem.

Check plunkr

What should I do to get them aligned ? Is there a best practice ? Something I need to do to stay compliant to material guidelines ?

I do not have those problems with other icon library like font awesome. Is there any particular reason for that ?

Changing font-size doesn't make them look better either

Most helpful comment

You can try this:

<style>
  .line-with-icon md-icon {
    font-size: 1rem;
    width: inherit;
    height: 1.2rem;
    vertical-align: middle;
  }
</style>

All 6 comments

You can try this:

<style>
  .line-with-icon md-icon {
    font-size: 1rem;
    width: inherit;
    height: 1.2rem;
    vertical-align: middle;
  }
</style>

This is working fine, thank you. However, I don't think it's normal to have to do that in order to have normal alignment. That's wierd

@Robouste, I agree with you. I would left the issue opened and wait for someone from material team's opinion. I'm not sure why md-icon behaves different of regular texts in this case.

Ok, I'm re-opening it then.

Please keep GitHub issues for bug reports / feature requests. Better avenues for troubleshooting / questions are Stack Overflow, gitter, mailing list, etc. Please use our template when filing bugs/feature requests.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RoxKilly picture RoxKilly  路  3Comments

dzrust picture dzrust  路  3Comments

michaelb-01 picture michaelb-01  路  3Comments

3mp3ri0r picture 3mp3ri0r  路  3Comments

Miiekeee picture Miiekeee  路  3Comments