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 {
@@ -103,34 +111,22 @@ $mat-card-header-size: 40px !default;
103
111
104
112
// TITLE-GROUP STYLES
105
113
106
- // images grouped with title in title-group layout
107
- %mat-card-title-img {
108
- // As per Material Design specifications, the images exceed the *top* content-box and take
109
- // up some space. The margin below is necessary because otherwise space of the actual card
110
- // content will be overlapped.
111
- margin : -8px 0 8px 0 ;
112
- }
113
-
114
114
.mat-card-title-group {
115
115
display : flex ;
116
116
justify-content : space-between ;
117
- margin : 0 -8px ;
118
117
}
119
118
120
119
.mat-card-sm-image {
121
- @extend %mat-card-title-img ;
122
120
width : 80px ;
123
121
height : 80px ;
124
122
}
125
123
126
124
.mat-card-md-image {
127
- @extend %mat-card-title-img ;
128
125
width : 112px ;
129
126
height : 112px ;
130
127
}
131
128
132
129
.mat-card-lg-image {
133
- @extend %mat-card-title-img ;
134
130
width : 152px ;
135
131
height : 152px ;
136
132
}
@@ -146,27 +142,16 @@ $mat-card-header-size: 40px !default;
146
142
// Special treatment inside title group in order to fix the media areas inside of a title-group.
147
143
// This can be removed once #12203 has been addressed.
148
144
.mat-card-title-group > & {
149
- @extend %mat-card-title-img ;
145
+ // As per Material Design specifications, the images exceed the *top* content-box and take
146
+ // up some space. The margin below is necessary because otherwise space of the actual card
147
+ // content will be overlapped.
148
+ margin : -8px 0 8px 0 ;
150
149
}
151
150
}
152
151
153
152
// MEDIA QUERIES
154
153
155
154
@media ($mat-xsmall ) {
156
- .mat-card {
157
- padding : $mat-card-mobile-padding ;
158
- }
159
-
160
- .mat-card-actions {
161
- margin-left : -8px ;
162
- margin-right : -8px ;
163
- }
164
-
165
- .mat-card-image {
166
- width : calc (100% + 32px );
167
- margin : 16px -16px ;
168
- }
169
-
170
155
.mat-card-title-group {
171
156
margin : 0 ;
172
157
}
@@ -175,16 +160,6 @@ $mat-card-header-size: 40px !default;
175
160
margin-left : 0 ;
176
161
margin-right : 0 ;
177
162
}
178
-
179
- .mat-card-header {
180
- margin : -8px 0 0 0 ;
181
- }
182
-
183
- .mat-card-footer {
184
- margin-left : -16px ;
185
- margin-right : -16px ;
186
- }
187
-
188
163
}
189
164
190
165
// FIRST/LAST CHILD ADJUSTMENTS
@@ -203,15 +178,17 @@ $mat-card-header-size: 40px !default;
203
178
}
204
179
205
180
// if main image is on top, need to place it flush against top
206
- // (by stripping card's default 24px padding)
181
+ // (by stripping card's default padding)
207
182
.mat-card-image :first-child {
208
- margin-top : -24px ;
183
+ margin-top : - $mat-card-padding ;
184
+ border-top-left-radius : inherit ;
185
+ border-top-right-radius : inherit ;
209
186
}
210
187
211
188
// actions panel on bottom should be 8px from bottom of card
212
- // so must strip 16px from default card padding of 24px
189
+ // so must strip 16px from default card padding
213
190
.mat-card > .mat-card-actions :last-child {
214
- margin-bottom : -16 px ;
191
+ margin-bottom : -8 px ;
215
192
padding-bottom : 0 ;
216
193
}
217
194
@@ -223,6 +200,10 @@ $mat-card-header-size: 40px !default;
223
200
margin-right : 0 ;
224
201
}
225
202
203
+ .mat-card-title {
204
+ margin-bottom : 8px ;
205
+ }
206
+
226
207
// should be 12px space between titles and subtitles generally
227
208
// default margin-bottom is 16px, so need to move lower title up 4px
228
209
.mat-card-title :not (:first-child ), .mat-card-subtitle :not (:first-child ) {
@@ -236,13 +217,13 @@ $mat-card-header-size: 40px !default;
236
217
}
237
218
238
219
// xl image should always have 16px on top.
239
- // when it's the first el, it'll need to remove 8px from default card padding of 24px
220
+ // when it's the first el, it'll need to remove 8px from default card padding
240
221
.mat-card > .mat-card-xl-image :first-child {
241
222
margin-top : -8px ;
242
223
}
243
224
244
225
// xl image should always have 16px on bottom
245
- // when it's the last el, it'll need to remove 8px from default card padding of 24px
226
+ // when it's the last el, it'll need to remove 8px from default card padding
246
227
.mat-card > .mat-card-xl-image :last-child {
247
228
margin-bottom : -8px ;
248
229
}
0 commit comments