Skip to content

Commit

Permalink
Fix wordpress left and right float alignments
Browse files Browse the repository at this point in the history
  • Loading branch information
itsamoreh committed Aug 8, 2023
1 parent 0327cd3 commit 4ee2f17
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions assets/css/alignments.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
@media (min-width: 1000px) {
body {
.is-layout-constrained {
body {
.is-layout-constrained {
> .alignleft {
margin: var(--wp--custom--spacing--gap);
margin-left: 0;
padding-left: 0;
}

> .alignright {
margin: var(--wp--custom--spacing--gap);
margin-right: 0;
padding-right: 0;
}

/*
Center floated images on small screens.
*/
@media (max-width: 480px) {
> .alignleft {
float: none;
margin: var(--wp--custom--spacing--gap) auto;
}

> .alignright {
float: none;
margin: var(--wp--custom--spacing--gap) auto;
}
}

/*
Prevent floated images from going outside of the contentSize area.
calc( var(--wp--style--global--content-size) + var(--wp--custom--spacing--gap) * 2 )
*/
@media (min-width: calc(1000px + 24px * 2)) {
> .alignleft {
margin: var(--wp--custom--spacing--gap);
margin-left: calc((100% - var(--wp--style--global--content-size)) / 2);
padding-left: 0;
}

> .alignright {
margin: var(--wp--custom--spacing--gap);
margin-right: calc((100% - var(--wp--style--global--content-size)) / 2);
padding-right: 0;
}
}
}
Expand Down

0 comments on commit 4ee2f17

Please sign in to comment.