I want to change the global, default padding on a Angular Material, mat-card.
In the angular.json I have this specification:
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles/app.theme.scss",
"src/styles/styles.scss"
],
i make the adjustment inside of styles.scss
.mat-card {
margin: 5px;
padding: 5px;}
Result is that margin works, while padding does not. this is the result in the devtools. I see there is a .mat-card in <style>
that takes precedence.
How do I set the padding on a global basis on a mat-card
?
Angular Material (MAT) Card and Paginator What is the MAT Card? <mat-card> is a content container for works, photos, and text about a subject.
<mat-card> is a content container for works, photos, and text about a subject. Basic card requires only the <mat-card> element with only some content. Although, it provides several preset sections that you can use inside <mat-card>: S. No 1.
<mat-card> is a content container for text, photos, and actions in the context of a single subject. The most basic card needs only an <mat-card> element with some content. However, Angular Material provides a number of preset sections that you can use inside of an <mat-card>:
Although, the align property can be used to perform actions at the 'start' or 'end' of a <mat-card-actions> container. The card header gives the ability to add a rich header to a card section. The header can contain all of these sections:
You must scope them. Angular will take css of its own component first. So if you want to change globally scope them with any class name such as 'custom'.
<mat-card class="custom"></mat-card>
In stylesheet
.custom.mat-card{
//your styles
}
To know more, refer to angular material customizing
dotless: .mat-card --> mat-card
mat-card { margin: 5px; padding: 5px;}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With