Last active
December 18, 2020 22:26
-
-
Save keithdevon/7ff062427f33177e1272cc1f38602f6c to your computer and use it in GitHub Desktop.
Gutenberg columns block alignment fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--gutter: 32px; | |
} | |
@media screen and (min-width: 782px) { | |
/* For the '25's' in the 25 / 50 / 25 variation */ | |
.wp-block-column[style='flex-basis:25%'] { | |
flex-basis: calc(var(--gutter) * 2) !important; | |
flex-grow: 1; | |
} | |
/* For the '50' in the 25 / 50 / 25 variation */ | |
.wp-block-column[style='flex-basis:50%'] { | |
flex-basis: calc(var(--gutter) * 5) !important; | |
flex-grow: 2; | |
} | |
/* For the '30' in the '70 / 30' variation */ | |
.wp-block-column[style='flex-basis:33.33%'] { | |
flex-basis: calc(var(--gutter) * 3) !important; | |
flex-grow: 1; | |
} | |
/* For the '70' in the '70 / 30' variation */ | |
.wp-block-column[style='flex-basis:66.66%'] { | |
flex-basis: calc(var(--gutter) * 7) !important; | |
flex-grow: 2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code will fix the alignment of the default column block variations. Specifically the '70 / 30', '30 / 70', and '25 / 50 / 25' variations.
It does this by targeting the specific
style="flex-basis: X%"
attribute that is added to these variations.If a custom column width is set, the code will no longer affect the alignment and will use the default styling.