Skip to content

Instantly share code, notes, and snippets.

@alinademi
Forked from ajvillegas/style.css
Created December 14, 2024 05:48
Show Gist options
  • Save alinademi/eb0b25cd4231d2747bc087b5534b77b7 to your computer and use it in GitHub Desktop.
Save alinademi/eb0b25cd4231d2747bc087b5534b77b7 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