Created
April 29, 2020 13:34
-
-
Save darinronne/c6f236f5f28326a80827289f0d8d1460 to your computer and use it in GitHub Desktop.
Wordpress Gutenberg Gallery Block Gutter Styles
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
$wp-block-gallery-classes: ( | |
'': 20px, | |
'.has-no-gutters': 0, | |
'.has-large-gutters': 50px, | |
); | |
@each $class, $gutter in $wp-block-gallery-classes { | |
#{$class}.blocks-gallery-grid, | |
.wp-block-gallery#{$class} { | |
.blocks-gallery-image, | |
.blocks-gallery-item { | |
margin: 0 $gutter $gutter 0; | |
width: calc((100% - #{$gutter})/2); | |
&:nth-of-type(2n) { | |
margin-right:0; | |
} | |
} | |
@media (min-width:600px) { | |
@for $i from 3 through 8 { | |
&.columns-#{$i} .blocks-gallery-image, | |
&.columns-#{$i} .blocks-gallery-item { | |
width: calc((100% - #{$gutter * ($i - 1)})/#{$i}); | |
margin-right: $gutter; | |
} | |
@supports (-ms-ime-align:auto) { | |
&.columns-#{$i} .blocks-gallery-image, | |
&.columns-#{$i} .blocks-gallery-item { | |
width: calc((100% - #{$gutter * ($i - 1)})/#{$i} - 1px); | |
} | |
} | |
} | |
@for $i from 1 through 8 { | |
&.columns-#{$i} .blocks-gallery-image:nth-of-type(#{$i}n), | |
&.columns-#{$i} .blocks-gallery-item:nth-of-type(#{$i}n) { | |
margin-right:0; | |
} | |
} | |
} | |
.blocks-gallery-image:last-child, | |
.blocks-gallery-item:last-child { | |
margin-right: 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment