Skip to content

Commit 7400d2b

Browse files
committed
Support alignwide and alignfull
1 parent a3d4df5 commit 7400d2b

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

templates/style.php

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,22 @@
2828
$link_color = $this->get_customizer_setting( 'link_color' );
2929
$header_background_color = $this->get_customizer_setting( 'header_background_color' );
3030
$header_color = $this->get_customizer_setting( 'header_color' );
31+
32+
$alignwide_max = $content_max_width > 0 ? $content_max_width * 2 : 1920
3133
?>
3234
/* Generic WP styling */
3335

36+
.alignnone,
37+
.aligncenter,
38+
.alignleft,
39+
.alignright,
40+
.alignwide {
41+
margin-top: 1em;
42+
margin-right: auto;
43+
margin-bottom: 1em;
44+
margin-left: auto;
45+
}
46+
3447
.alignright {
3548
float: right;
3649
}
@@ -46,6 +59,35 @@
4659
margin-right: auto;
4760
}
4861

62+
.alignwide {
63+
width: 100%;
64+
}
65+
66+
@media (min-width: calc(840px - 48px)) {
67+
.alignwide {
68+
width: calc(100vw - 48px);
69+
max-width: calc(100vw - 48px);
70+
margin-left: calc(50% - 50vw + 24px);
71+
margin-right: calc(50% - 50vw + 24px);
72+
}
73+
}
74+
75+
@media (min-width: calc(<?php echo sprintf( '%dpx', $alignwide_max ); ?>)) {
76+
.alignwide {
77+
width: calc(<?php echo sprintf( '%dpx', $alignwide_max ); ?> - 48px);
78+
max-width: calc(<?php echo sprintf( '%dpx', $alignwide_max ); ?> - 48px);
79+
margin-left: calc(calc(50% - <?php echo sprintf( '%dpx', $alignwide_max ); ?> / 2) + 24px);
80+
margin-right: calc(calc(50% - <?php echo sprintf( '%dpx', $alignwide_max ); ?> / 2) + 24px);
81+
}
82+
}
83+
84+
.alignfull {
85+
width: 100vw;
86+
max-width: 100vw;
87+
margin-left: calc(50% - 50vw);
88+
margin-right: calc(50% - 50vw);
89+
}
90+
4991
.amp-wp-enforced-sizes {
5092
/** Our sizes fallback is 100vw, and we have a padding on the container; the max-width here prevents the element from overflowing. **/
5193
max-width: 100%;
@@ -264,8 +306,7 @@
264306
max-width: 100%;
265307
}
266308

267-
.amp-wp-article-content amp-img,
268-
.amp-wp-article-content .wp-block-cover {
309+
.amp-wp-article-content amp-img {
269310
margin: 0 auto;
270311
}
271312

0 commit comments

Comments
 (0)