Skip to content

Instantly share code, notes, and snippets.

@ajvillegas
Created November 14, 2023 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajvillegas/ff499ea7bf10eb17829f5e2bae6d5171 to your computer and use it in GitHub Desktop.
Save ajvillegas/ff499ea7bf10eb17829f5e2bae6d5171 to your computer and use it in GitHub Desktop.
Wide and Full-Width Alignment in WP
/* Break out of a container in a WP site. */
/* Exclude blocks in the editor. */
.alignfull:not(.wp-block) {
margin-left: calc( 50% - 50vw );
margin-right: calc( 50% - 50vw );
max-width: 100vw;
}
.alignwide {
margin-left: max(
( 50% - 50vw ) + var( --wp--style--root--padding-left ),
( var( --wp--style--global--wide-size ) - var( --wp--style--global--content-size ) ) / -2
);
margin-right: max(
( 50% - 50vw ) + var( --wp--style--root--padding-right ),
( var( --wp--style--global--wide-size ) - var( --wp--style--global--content-size ) ) / -2
);
max-width: 100vw;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment