forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathampshared.css
459 lines (395 loc) · 10.5 KB
/
ampshared.css
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
/**
* Copyright 2019 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* We intentionally break with HTML5's default [hidden] styling to apply
* !important.
*/
[hidden] {
/* This must be !important, else the toggle helper system would break down
due to specificity */
display: none !important;
}
.i-amphtml-element {
display: inline-block;
}
.i-amphtml-blurry-placeholder {
transition: opacity 0.3s cubic-bezier(0.0, 0.0, 0.2, 1) !important;
}
/* layout=nodisplay are automatically hidden until JS initializes. */
[layout=nodisplay]:not(.i-amphtml-element) {
display: none !important;
}
/* Initialized layout=nodisplay contain [hidden] */
.i-amphtml-layout-nodisplay[hidden],
[layout=nodisplay][hidden]:not(.i-amphtml-layout-nodisplay)
{
/* Display is set/reset via the hidden attribute */
}
.i-amphtml-layout-nodisplay:not([hidden]),
[layout=nodisplay]:not(.i-amphtml-layout-nodisplay[hidden])
{
/* Display is set/reset via the hidden attribute */
}
.i-amphtml-layout-fixed,
[layout=fixed][width][height]:not(.i-amphtml-layout-fixed)
{
display: inline-block;
position: relative;
}
.i-amphtml-layout-responsive,
[layout=responsive][width][height]:not(.i-amphtml-layout-responsive),
[width][height][sizes]:not(.i-amphtml-layout-responsive)
{
display: block;
position: relative;
}
.i-amphtml-layout-intrinsic
{
display: inline-block;
position: relative;
max-width: 100%;
}
.i-amphtml-intrinsic-sizer {
max-width: 100%;
display: block !important;
}
.i-amphtml-layout-fixed-height,
[layout=fixed-height][height]
{
display: block;
position: relative;
}
.i-amphtml-layout-container,
[layout=container]
{
display: block;
position: relative;
}
.i-amphtml-layout-fill,
[layout=fill]:not(.i-amphtml-layout-fill)
{
display: block;
overflow: hidden !important;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.i-amphtml-layout-flex-item,
[layout=flex-item]:not(.i-amphtml-layout-flex-item)
{
display: block;
position: relative;
flex: 1 1 auto;
}
.i-amphtml-layout-fluid {
position: relative;
}
.i-amphtml-layout-size-defined {
overflow: hidden !important;
}
.i-amphtml-layout-awaiting-size {
position: absolute !important;
top: auto !important;
bottom: auto !important;
}
i-amphtml-sizer {
display: block !important;
}
.i-amphtml-fill-content,
.i-amphtml-blurry-placeholder {
display: block;
/* These lines are a work around to this issue in iOS: */
/* https://bugs.webkit.org/show_bug.cgi?id=155198 */
/* And: https://github.com/ampproject/amphtml/issues/11133 */
height: 0;
max-height: 100%;
max-width: 100%;
min-height: 100%;
min-width: 100%;
width: 0;
margin: auto;
}
.i-amphtml-layout-size-defined .i-amphtml-fill-content {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.i-amphtml-layout-intrinsic .i-amphtml-sizer {
max-width: 100%;
}
.i-amphtml-replaced-content {
padding: 0 !important;
border: none !important;
/* TODO(dvoytenko): explore adding here object-fit. */
}
/**
* Makes elements visually invisible but still accessible to screen-readers.
*
* This Css has been carefully tested to ensure screen-readers can read and
* activate (in case of links and buttons) the elements with this class. Please
* use caution when changing anything, even seemingly safe ones. For example
* changing width from 1 to 0 would prevent TalkBack from activating (clicking)
* buttons despite TalkBack reading them just fine. This is because
* element needs to have a defined size and be on viewport otherwise TalkBack
* does not allow activation of buttons.
*/
.i-amphtml-screen-reader {
position: fixed !important;
/* keep it on viewport */
top: 0px !important;
left: 0px !important;
/* give it non-zero size, VoiceOver on Safari requires at least 2 pixels
before allowing buttons to be activated. */
width: 4px !important;
height: 4px !important;
/* visually hide it with overflow and opacity */
opacity: 0 !important;
overflow: hidden !important;
/* remove any margin or padding */
border: none !important;
margin: 0 !important;
padding: 0 !important;
/* ensure no other style sets display to none */
display: block !important;
visibility: visible !important;
}
.i-amphtml-screen-reader ~ .i-amphtml-screen-reader {
left: 8px !important;
}
.i-amphtml-screen-reader ~ .i-amphtml-screen-reader ~ .i-amphtml-screen-reader {
left: 12px !important;
}
.i-amphtml-screen-reader ~ .i-amphtml-screen-reader ~ .i-amphtml-screen-reader ~ .i-amphtml-screen-reader {
left: 16px !important;
}
/* For author styling. */
.amp-unresolved {
}
.i-amphtml-unresolved {
position: relative;
overflow: hidden !important;
}
.i-amphtml-select-disabled {
user-select: none !important;
}
/* "notbuild" classes are set as soon as an element is created and removed
as soon as the element is built. */
.amp-notbuilt {
/* For author styling. */
}
.i-amphtml-notbuilt,
[layout]:not(.i-amphtml-element)
{
position: relative;
overflow: hidden !important;
color: transparent !important;
}
.i-amphtml-notbuilt:not(.i-amphtml-layout-container) > * ,
[layout]:not([layout=container]):not(.i-amphtml-element) > *
{
display: none;
}
.i-amphtml-ghost {
visibility: hidden !important;
}
.i-amphtml-layout {
/* Just state. */
}
.i-amphtml-error {
/* Just state. */
}
.i-amphtml-element > [placeholder],
[layout]:not(.i-amphtml-element) > [placeholder] {
display: block;
}
.i-amphtml-element > [placeholder].hidden,
.i-amphtml-element > [placeholder].amp-hidden {
visibility: hidden;
}
/* Placeholder, by design, expands layout=container unlike other layouts where
it is position:absolute and overlays the layout box.
However, when it goes away it should no longer expand the parent, so instead
of visibility:hidden it must be display:none */
.i-amphtml-layout-container > [placeholder].hidden,
.i-amphtml-layout-container > [placeholder].amp-hidden {
display: none;
}
.i-amphtml-element:not(.amp-notsupported) > [fallback] {
display: none;
}
.i-amphtml-layout-size-defined > [placeholder],
.i-amphtml-layout-size-defined > [fallback] {
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
z-index: 1;
}
.i-amphtml-notbuilt > [placeholder] {
display: block !important;
}
.i-amphtml-hidden-by-media-query {
display: none !important;
}
.i-amphtml-element-error {
background: red !important;
color: white !important;
position: relative !important;
}
.i-amphtml-element-error::before {
content: attr(error-message);
}
/**
* Wraps an element to make the contents scrollable. This is
* used to wrap iframes which in iOS always behave as if they had the
* seamless attribute.
* TODO(dvoytenko, #8464): cleanup old `i-amp-scroll-container`.
*/
i-amphtml-scroll-container, i-amp-scroll-container {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
}
/**
* Overflow:auto will be set with delay due to iOS bug where iframe is not
* rendered.
* TODO(dvoytenko, #8464): cleanup old `i-amp-scroll-container`.
*/
i-amphtml-scroll-container.amp-active, i-amp-scroll-container.amp-active {
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.i-amphtml-loading-container {
display: block !important;
pointer-events: none;
z-index: 1;
}
.i-amphtml-notbuilt > .i-amphtml-loading-container {
display: block !important;
}
.i-amphtml-loading-container.amp-hidden {
visibility: hidden;
}
/**
* "overflow" element is an element shown when more content is available but
* not currently visible. Typically tapping on this element shows the full
* content.
*/
.i-amphtml-element > [overflow] {
cursor: pointer;
/* position:relative is critical to ensure that [overflow] is displayed
above an iframe; z-index is not enough. */
position: relative;
z-index: 2;
visibility: hidden;
}
.i-amphtml-element > [overflow].amp-visible {
visibility: visible;
}
/* Polyfill for IE and any other browser that don't understand templates. */
template {
display: none !important;
}
/**
* Authors can set this class on their html tags to provide `border-box` box-sizing
* to every element in their document. Individual elements can override as necessary.
*/
.amp-border-box,
.amp-border-box *,
.amp-border-box *:before,
.amp-border-box *:after {
box-sizing: border-box;
}
/* amp-pixel is always non-displayed. */
amp-pixel {
display: none !important;
}
/**
* Analytics & amp-story-auto-ads tags should never be visible. keep them hidden.
*/
amp-analytics, amp-story-auto-ads {
/* Fixed to make position independent of page other elements. */
position: fixed !important;
top: 0 !important;
width: 1px !important;
height: 1px !important;
overflow: hidden !important;
visibility: hidden;
}
html.i-amphtml-fie > amp-analytics {
/* Remove position fixed if it's in iframe.
* So runtime can measure layoutBox correctly
*/
position: initial !important;
}
/**
* Forms error/success messaging containers should be hidden at first.
*/
form [submitting],
form [submit-success],
form [submit-error] {
display: none;
}
/**
* amp-list error messaging container should be hidden at first.
*/
amp-list [fetch-error] {
display: none;
}
/**
* Form validation error messages should be hidden at first.
*/
[visible-when-invalid]:not(.visible) {
display: none;
}
/**
* amp-accordion to avoid FOUC.
*/
/* Non-overridable properties */
amp-accordion {
display: block !important;
}
/* Make sections non-floatable */
amp-accordion > section {
float: none !important;
}
/* Display the first 2 elements (heading and content) */
amp-accordion > section > * {
float: none !important;
display: block !important;
overflow: hidden !important; /* clearfix */
position: relative !important;
}
amp-accordion,
amp-accordion > section {
margin: 0;
}
/* Collapse content by default. */
amp-accordion > section > :last-child {
display: none !important;
}
/* Expand content when needed. */
amp-accordion > section[expanded] > :last-child {
display: block !important;
}