Angular Material Icon apparently doesn't align no matter what you do with it? It never aligns despite Flex Layout directives and CSS affecting it


Sebastian

Example : https://i.imgur.com/Xd0XkmE.png _

I've tried fxFlexAlign-fxLayoutAlign on the parent, giving it an ID and using display:flex + justify-content:center on everything with ! important.

The thing is - all of the above does something to it, it reacts to CSS and FlexLayout directives, but anyway things still look clearly out of alignment.

Upon inspection, it's clear that it's growing from the bottom right corner of the "container" and doesn't care about the alignment at all.

Am I missing something in dealing with these? I went through the documentation + stackoverflow + google searches and couldn't find anything.

G. Trant

You mention in the comments to the answer you posted that the font size is being changed, which is causing the problem. I think I recall a bug with this - at least I know I've run into it. Besides the font size, you also need to adjust the width and height accordingly. Actually, it's better to define classes to handle everything and apply it to the mat-icon element. E.g:

.mat-icon-16 {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

<mat-icon class="mat-icon-16">help<mat-icon>

Note that the row height also scrolls, but it's "1" by default, so you don't need to change that value.

Related


Flex div doesn't align left, it aligns right

Tomazbyden2000 I have a bootstrap 4 header where I use flex for some custom layouts. Here is the html: <nav class="navbar"> <div class="container-fluid"> <a class="navbar-brand" href="#"> <img src="logo.png" alt=""> </a> <div class="box">

Basic Angular material layout/flex example doesn't work

Onestone I tried a basic layout/flex example from Angular's material design demo site: https://material.angularjs.org/latest/layout/container But no matter what I do, it doesn't work as instructed, only showing the four inner divs below each other at 100% widt

Basic Angular material layout/flex example doesn't work

Onestone I tried a basic layout/flex example from Angular's material design demo site: https://material.angularjs.org/latest/layout/container But no matter what I do, it doesn't work as instructed, only showing the four inner divs below each other at 100% widt

Basic Angular material layout/flex example doesn't work

Onestone I tried a basic layout/flex example from Angular's material design demo site: https://material.angularjs.org/latest/layout/container But no matter what I do, it doesn't work as instructed, only showing the four inner divs below each other at 100% widt

Flex layout issue - Angular Material table - doesn't fit in div

Mr. Learner I'm trying to flex.but I end up with inconsistent heights . When changing the pagination value and overlapping below the card , my mat table height goes beyond the outside . I thought it would help me, but it doesn't seem to.divoverflow: auto I nee

Basic Angular material layout/flex example doesn't work

Onestone I tried a basic layout/flex example from Angular's material design demo site: https://material.angularjs.org/latest/layout/container But no matter what I do, it doesn't work as instructed, only showing the four inner divs below each other at 100% widt

Basic Angular material layout/flex example doesn't work

Onestone I tried a basic layout/flex example from Angular's material design demo site: https://material.angularjs.org/latest/layout/container But no matter what I do, it doesn't work as instructed, only showing the four inner divs below each other at 100% widt

Angular material layout-align="center center" doesn't work

Prabhdeep I'm trying to use layout-align="center center" which should center the content both vertically and horizontally. But this just aligns the content horizontally instead of vertically. Here 's a plnkr link to the code I'm trying . <body ng-app="app" ng-

Angular material layout-align="center center" doesn't work

Prabhdeep I'm trying to use layout-align="center center" which should center the content both vertically and horizontally. But this just aligns the content horizontally instead of vertically. Here 's a plnkr link to the code I'm trying . <body ng-app="app" ng-

Angular material layout-align="center center" doesn't work

Prabhdeep I'm trying to use layout-align="center center" which should center the content both vertically and horizontally. But this just aligns the content horizontally instead of vertically. Here 's a plnkr link to the code I'm trying . <body ng-app="app" ng-

Angular material layout-align="center center" doesn't work

Prabhdeep I'm trying to use layout-align="center center" which should center the content both vertically and horizontally. But this just aligns the content horizontally instead of vertically. Here 's a plnkr link to the code I'm trying . <body ng-app="app" ng-

Angular material layout-align="center center" doesn't work

Prabhdeep I'm trying to use layout-align="center center" which should center the content both vertically and horizontally. But this just aligns the content horizontally instead of vertically. Here 's a plnkr link to the code I'm trying . <body ng-app="app" ng-