Skip to content

Commit bdd9c14

Browse files
committed
fix(card): prevent content from overlapping footer
* Prevents content from overlapping the `md-card-footer` component by making the footer `position: static`. * Uses content projection to ensure that the footer will always be at the bottom of a card. Fixes #5486.
1 parent b3957d8 commit bdd9c14

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/lib/card/card.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
<ng-content></ng-content>
2+
<ng-content select="md-card-footer, mat-card-footer"></ng-content>

src/lib/card/card.scss

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ $mat-card-header-size: 40px !default;
6262
}
6363

6464
.mat-card-footer {
65-
position: absolute;
66-
width: 100%;
67-
min-height: 5px;
68-
bottom: 0;
69-
left: 0;
65+
$margin: -$mat-card-default-padding;
66+
67+
display: block;
68+
margin: 0 $margin $margin $margin;
7069
}
7170

7271
.mat-card-actions {
@@ -154,6 +153,11 @@ $mat-card-header-size: 40px !default;
154153
margin: -8px 0 0 0;
155154
}
156155

156+
.mat-card-footer {
157+
margin-left: -16px;
158+
margin-right: -16px;
159+
}
160+
157161
}
158162

159163
// FIRST/LAST CHILD ADJUSTMENTS
@@ -166,7 +170,8 @@ $mat-card-header-size: 40px !default;
166170

167171
// last els in mat-card-content and mat-card can't have their default margin-bottoms (e.g. <p> tags)
168172
// or they'll incorrectly add to card's bottom padding
169-
.mat-card > :last-child, .mat-card-content > :last-child {
173+
.mat-card > :last-child:not(.mat-card-footer),
174+
.mat-card-content > :last-child:not(.mat-card-footer) {
170175
margin-bottom: 0;
171176
}
172177

0 commit comments

Comments
 (0)