Reputation: 2137
I have an angular material button:
<a mat-raised-button class="buttons-class" color="accent">Hello!</a>
And I have increased its size:
.buttons-class {
height: 60px !important;
width: 210px !important;
align-items: center;
}
Now, I wish to center the text (Hello!
) within it. Currently the text is offset like this:
Putting the text in a span or div and using the standard centering techniques didn't work.
Upvotes: 2
Views: 7676
Reputation: 51
Add the following styles please.
.buttons-class {
height: 60px !important;
width: 210px !important;
display: flex;
align-items: center;
justify-content: center;
}
Upvotes: 1
Reputation: 19
you can use ng-deep ::ng-deep shadow-piercing descendant combinator to force a style down through the child component tree into all the child component views and styling any class
::ng-deep.buttons-class {
height: 60px !important;
width: 210px !important;
display: flex;
align-items: center;
justify-content: center;
}
Upvotes: 1