Just add [style.backgroundColor]="'COLOR_YOU_WANT'"
to your selector <md-card-header>
:
<md-card>
<md-card-header [style.backgroundColor]="'yellow'">
<md-card-title>Title</md-card-title>
<md-card-subtitle>Subtitle</md-card-subtitle>
</md-card-header>
<md-card-content>
Body text
</md-card-content>
</md-card>
Link to the working demo .
Or add a class to your CSS file:
.custom-card {
background-color: gray;
}
and set [ngClass]
in the selector <md-card-header>
:
<md-card>
<md-card-header [ngClass]="{'custom-card':true}">
<md-card-title>Title</md-card-title>
<md-card-subtitle>Subtitle</md-card-subtitle>
</md-card-header>
<md-card-content>
Body text
</md-card-content>
</md-card>
or another alternative is to use [ngStyle]
:
<md-card [ngStyle]="{'padding':'0px'}">
<md-card-header [ngStyle]="{'background-color':'green'}">
<md-card-title [ngStyle]="{'font-size':'24px'}">Title</md-card-title>
<md-card-subtitle [ngStyle]="{'font-size':'12px', 'color':'white'}">Subtitle</md-card-subtitle>
</md-card-header>
<md-card-content>
Body text
</md-card-content>
</md-card>
source
share