3
3
@import ' ../../cdk/a11y/a11y' ;
4
4
5
5
6
- $mat-card-default-padding : 24px !default ;
7
- $mat-card-mobile-padding : 24px 16px !default ;
8
- $mat-card-border-radius : 2px !default ;
6
+ $mat-card-padding : 16px !default ;
7
+ $mat-card-border-radius : 4px !default ;
9
8
$mat-card-header-size : 40px !default ;
10
9
11
10
.mat-card {
12
11
@include mat-elevation-transition ;
13
12
display : block ;
14
13
position : relative ;
15
- padding : $mat-card-default- padding ;
14
+ padding : $mat-card-padding ;
16
15
border-radius : $mat-card-border-radius ;
17
16
18
17
.mat-divider-horizontal {
@@ -47,14 +46,19 @@ $mat-card-header-size: 40px !default;
47
46
margin-bottom : 16px ;
48
47
}
49
48
50
- .mat-card-title , .mat-card-subtitle , .mat-card-content {
49
+ .mat-card-title {
50
+ display : block ;
51
+ margin-bottom : 8px ;
52
+ }
53
+
54
+ .mat-card-subtitle , .mat-card-content {
51
55
@extend %mat-card-section-base ;
52
56
}
53
57
54
58
.mat-card-actions {
55
59
@extend %mat-card-section-base ;
56
- margin-left : -16 px ;
57
- margin-right : -16 px ;
60
+ margin-left : - $mat-card-padding / 2 ;
61
+ margin-right : - $mat-card-padding / 2 ;
58
62
padding : 8px 0 ;
59
63
}
60
64
@@ -64,22 +68,22 @@ $mat-card-header-size: 40px !default;
64
68
}
65
69
66
70
.mat-card-image {
67
- width : calc (100% + 48 px );
68
- margin : 0 -24 px 16px -24 px ;
71
+ width : calc (100% + #{ $mat-card-padding * 2 } );
72
+ margin : 0 ( - $mat-card-padding ) 16px ( - $mat-card-padding ) ;
69
73
}
70
74
71
75
.mat-card-footer {
72
76
// The negative margins pulls out the element, countering the padding
73
77
// to get the footer to be flush against the side of the card.
74
- $margin : - $mat-card-default- padding ;
78
+ $margin : - $mat-card-padding ;
75
79
76
80
display : block ;
77
81
margin : 0 $margin $margin $margin ;
78
82
}
79
83
80
84
.mat-card-actions {
81
85
.mat-button , .mat-raised-button {
82
- margin : 0 4 px ;
86
+ margin : 0 8 px ;
83
87
}
84
88
}
85
89
@@ -88,10 +92,14 @@ $mat-card-header-size: 40px !default;
88
92
.mat-card-header {
89
93
display : flex ;
90
94
flex-direction : row ;
95
+
96
+ .mat-card-title {
97
+ margin-bottom : 12px ;
98
+ }
91
99
}
92
100
93
101
.mat-card-header-text {
94
- margin : 0 8 px ;
102
+ margin : 0 $mat-card-padding ;
95
103
}
96
104
97
105
.mat-card-avatar {
@@ -107,34 +115,22 @@ $mat-card-header-size: 40px !default;
107
115
108
116
// TITLE-GROUP STYLES
109
117
110
- // images grouped with title in title-group layout
111
- %mat-card-title-img {
112
- // As per Material Design specifications, the images exceed the *top* content-box and take
113
- // up some space. The margin below is necessary because otherwise space of the actual card
114
- // content will be overlapped.
115
- margin : -8px 0 8px 0 ;
116
- }
117
-
118
118
.mat-card-title-group {
119
119
display : flex ;
120
120
justify-content : space-between ;
121
- margin : 0 -8px ;
122
121
}
123
122
124
123
.mat-card-sm-image {
125
- @extend %mat-card-title-img ;
126
124
width : 80px ;
127
125
height : 80px ;
128
126
}
129
127
130
128
.mat-card-md-image {
131
- @extend %mat-card-title-img ;
132
129
width : 112px ;
133
130
height : 112px ;
134
131
}
135
132
136
133
.mat-card-lg-image {
137
- @extend %mat-card-title-img ;
138
134
width : 152px ;
139
135
height : 152px ;
140
136
}
@@ -150,27 +146,16 @@ $mat-card-header-size: 40px !default;
150
146
// Special treatment inside title group in order to fix the media areas inside of a title-group.
151
147
// This can be removed once #12203 has been addressed.
152
148
.mat-card-title-group > & {
153
- @extend %mat-card-title-img ;
149
+ // As per Material Design specifications, the images exceed the *top* content-box and take
150
+ // up some space. The margin below is necessary because otherwise space of the actual card
151
+ // content will be overlapped.
152
+ margin : -8px 0 8px 0 ;
154
153
}
155
154
}
156
155
157
156
// MEDIA QUERIES
158
157
159
158
@media ($mat-xsmall ) {
160
- .mat-card {
161
- padding : $mat-card-mobile-padding ;
162
- }
163
-
164
- .mat-card-actions {
165
- margin-left : -8px ;
166
- margin-right : -8px ;
167
- }
168
-
169
- .mat-card-image {
170
- width : calc (100% + 32px );
171
- margin : 16px -16px ;
172
- }
173
-
174
159
.mat-card-title-group {
175
160
margin : 0 ;
176
161
}
@@ -179,16 +164,6 @@ $mat-card-header-size: 40px !default;
179
164
margin-left : 0 ;
180
165
margin-right : 0 ;
181
166
}
182
-
183
- .mat-card-header {
184
- margin : -8px 0 0 0 ;
185
- }
186
-
187
- .mat-card-footer {
188
- margin-left : -16px ;
189
- margin-right : -16px ;
190
- }
191
-
192
167
}
193
168
194
169
// FIRST/LAST CHILD ADJUSTMENTS
@@ -207,15 +182,17 @@ $mat-card-header-size: 40px !default;
207
182
}
208
183
209
184
// if main image is on top, need to place it flush against top
210
- // (by stripping card's default 24px padding)
185
+ // (by stripping card's default padding)
211
186
.mat-card-image :first-child {
212
- margin-top : -24px ;
187
+ margin-top : - $mat-card-padding ;
188
+ border-top-left-radius : inherit ;
189
+ border-top-right-radius : inherit ;
213
190
}
214
191
215
192
// actions panel on bottom should be 8px from bottom of card
216
- // so must strip 16px from default card padding of 24px
193
+ // so must strip 16px from default card padding
217
194
.mat-card > .mat-card-actions :last-child {
218
- margin-bottom : -16 px ;
195
+ margin-bottom : -8 px ;
219
196
padding-bottom : 0 ;
220
197
}
221
198
@@ -227,6 +204,10 @@ $mat-card-header-size: 40px !default;
227
204
margin-right : 0 ;
228
205
}
229
206
207
+ .mat-card-title {
208
+ margin-bottom : 8px ;
209
+ }
210
+
230
211
// should be 12px space between titles and subtitles generally
231
212
// default margin-bottom is 16px, so need to move lower title up 4px
232
213
.mat-card-title :not (:first-child ), .mat-card-subtitle :not (:first-child ) {
@@ -240,13 +221,13 @@ $mat-card-header-size: 40px !default;
240
221
}
241
222
242
223
// xl image should always have 16px on top.
243
- // when it's the first el, it'll need to remove 8px from default card padding of 24px
224
+ // when it's the first el, it'll need to remove 8px from default card padding
244
225
.mat-card > .mat-card-xl-image :first-child {
245
226
margin-top : -8px ;
246
227
}
247
228
248
229
// xl image should always have 16px on bottom
249
- // when it's the last el, it'll need to remove 8px from default card padding of 24px
230
+ // when it's the last el, it'll need to remove 8px from default card padding
250
231
.mat-card > .mat-card-xl-image :last-child {
251
232
margin-bottom : -8px ;
252
233
}
0 commit comments