-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathstyle.scss
249 lines (222 loc) · 5.8 KB
/
style.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
.wp-block-cover-image,
.wp-block-cover {
position: relative;
background-size: cover;
background-position: center center;
min-height: 430px;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 1em;
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;
&.has-parallax {
background-attachment: fixed;
// Mobile Safari does not support fixed background attachment properly.
// See also https://stackoverflow.com/questions/24154666/background-size-cover-not-working-on-ios
// Chrome on Android does not appear to support the attachment at all: https://issuetracker.google.com/issues/36908439
@supports (-webkit-overflow-scrolling: touch) {
background-attachment: scroll;
}
// Remove the appearance of scrolling based on OS-level animation preferences.
@media (prefers-reduced-motion: reduce) {
background-attachment: scroll;
}
}
&.is-repeated {
background-repeat: repeat;
background-size: auto;
}
/**
* Set a default background color for has-background-dim _unless_ it includes another
* background-color class (e.g. has-green-background-color). The presence of another
* background-color class implies that another style will provide the background color
* for the overlay.
*
* See:
* - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545
* - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545
*/
&.has-background-dim:not([class*="-background-color"]) {
background-color: $black;
}
&.has-background-dim::before {
content: "";
background-color: inherit;
}
&.has-background-dim:not(.has-background-gradient)::before,
.wp-block-cover__gradient-background {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: z-index(".wp-block-cover.has-background-dim::before");
opacity: 0.5;
}
@for $i from 1 through 10 {
&.has-background-dim.has-background-dim-#{ $i * 10 } {
&:not(.has-background-gradient)::before,
.wp-block-cover__gradient-background {
opacity: $i * 0.1;
}
}
}
// Apply max-width to floated items that have no intrinsic width
&.alignleft,
&.alignright {
max-width: $content-width * 0.5;
width: 100%;
}
// Using flexbox without an assigned height property breaks vertical center alignment in IE11.
// Appending an empty ::after element tricks IE11 into giving the cover image an implicit height, which sidesteps this issue.
&::after {
display: block;
content: "";
font-size: 0;
min-height: inherit;
// IE doesn't support flex so omit that.
@supports (position: sticky) {
content: none;
}
}
// Aligned cover blocks should not use our global alignment rules
&.aligncenter,
&.alignleft,
&.alignright {
display: flex;
}
.wp-block-cover__inner-container {
width: 100%;
z-index: z-index(".wp-block-cover__inner-container");
color: $white;
}
p,
h1,
h2,
h3,
h4,
h5,
h6 {
&:not(.has-text-color) {
color: inherit;
}
}
// Position: Top
&.is-position-top-left {
align-items: flex-start;
justify-content: flex-start;
}
&.is-position-top-center {
align-items: flex-start;
justify-content: center;
}
&.is-position-top-right {
align-items: flex-start;
justify-content: flex-end;
}
// Position: Center
&.is-position-center-left {
align-items: center;
justify-content: flex-start;
}
&.is-position-center-center {
align-items: center;
justify-content: center;
}
&.is-position-center-right {
align-items: center;
justify-content: flex-end;
}
// Position: Bottom
&.is-position-bottom-left {
align-items: flex-end;
justify-content: flex-start;
}
&.is-position-bottom-center {
align-items: flex-end;
justify-content: center;
}
&.is-position-bottom-right {
align-items: flex-end;
justify-content: flex-end;
}
&.has-custom-content-position.has-custom-content-position {
.wp-block-cover__inner-container {
margin: 0;
width: auto;
}
}
// Extra specificity for in edit mode where other styles would override it otherwise.
img.wp-block-cover__image-background,
video.wp-block-cover__video-background {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
max-width: none;
max-height: none;
object-fit: cover;
outline: none;
border: none;
box-shadow: none;
}
}
.wp-block-cover__video-background {
z-index: z-index(".wp-block-cover__video-background");
}
.wp-block-cover__image-background {
z-index: z-index(".wp-block-cover__image-background");
}
// Styles below only exist to support older versions of the block.
// Versions that not had inner blocks and used an h2 heading had a section (and not a div) with a class wp-block-cover-image (and not a wp-block-cover).
// We are using the previous referred differences to target old versions.
section.wp-block-cover-image h2,
.wp-block-cover-image-text,
.wp-block-cover-text {
color: $white;
a,
a:hover,
a:focus,
a:active {
color: $white;
}
}
.wp-block-cover-image
.wp-block-cover {
&.has-left-content {
justify-content: flex-start;
}
&.has-right-content {
justify-content: flex-end;
}
}
section.wp-block-cover-image.has-left-content > h2,
.wp-block-cover-image.has-left-content .wp-block-cover-image-text,
.wp-block-cover.has-left-content .wp-block-cover-text {
margin-left: 0;
text-align: left;
}
section.wp-block-cover-image.has-right-content > h2,
.wp-block-cover-image.has-right-content .wp-block-cover-image-text,
.wp-block-cover.has-right-content .wp-block-cover-text {
margin-right: 0;
text-align: right;
}
section.wp-block-cover-image > h2,
.wp-block-cover-image .wp-block-cover-image-text,
.wp-block-cover .wp-block-cover-text {
font-size: 2em;
line-height: 1.25;
z-index: 1;
margin-bottom: 0;
max-width: $content-width;
padding: 0.44em;
text-align: center;
}