Skip to content

Commit 4ee16a9

Browse files
crisbetoandrewseguin
authored andcommitted
fix(card): unable to override elevation (#3139)
Fixes an issue that prevents users from overriding the elevation of cards. The issue was introduced with the switch to the `mat-` prefix which changed the styling of cards from an element selector to a class, which has a higher specificity than the elevation classes. This change only adds the card shadow if it doesn't have an elevation class. Fixes #3123.
1 parent 6e1f50b commit 4ee16a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lib/card/card.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ $mat-card-border-radius: 2px !default;
99
$mat-card-header-size: 40px !default;
1010

1111
.mat-card {
12-
@include mat-elevation(2);
1312
@include mat-elevation-transition;
1413
display: block;
1514
position: relative;
1615
padding: $mat-card-default-padding;
1716
border-radius: $mat-card-border-radius;
1817
font-family: $mat-font-family;
1918

19+
&:not([class*='mat-elevation-z']) {
20+
@include mat-elevation(2);
21+
}
22+
2023
@include cdk-high-contrast {
2124
outline: solid 1px;
2225
}

0 commit comments

Comments
 (0)