Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change size of mat-icon on Angular Material? [duplicate]

mat-icon tag of Angular Material always has default size is 24px. So how to change it ...???

.mat-icon { background-repeat: no-repeat; display: inline-block; fill: currentColor; height: 24px; width: 24px; } 
like image 816
Nguyễn Phúc Avatar asked Nov 15 '18 04:11

Nguyễn Phúc


People also ask

Does angular material have icons?

To use a ligature icon, put its text in the content of the mat-icon component. By default, <mat-icon> expects the Material icons font. (You will still need to include the HTML to load the font and its CSS, as described in the link).


2 Answers

font-size tends to mess with the position. I do something like:

<mat-icon class="icon-display">home</mat-icon> 

CSS:

.icon-display {    transform: scale(2); } 

Where the 2 can actually be any number. 2 doubles the original size.

like image 124
Petey Avatar answered Sep 28 '22 01:09

Petey


Since Angular Material uses 'Material Icons' Font-Family, the icon size depends on font-size.

Therefore, if you want to modify the size of the icon then you change its font-size in your CSS file.

For example,

.mat-icon {   font-size: 50px; } 
like image 30
holydragon Avatar answered Sep 28 '22 00:09

holydragon