Skip to content

Instantly share code, notes, and snippets.

@dutchcelt
Last active February 11, 2024 20:37
Show Gist options
  • Select an option

  • Save dutchcelt/7137890 to your computer and use it in GitHub Desktop.

Select an option

Save dutchcelt/7137890 to your computer and use it in GitHub Desktop.
Using LESS to create multiple columns with equal gutter and content widths.
.box-to-grid( @columns; @gutter-size: 2em ){
@responsiveColumn: ( 100 / @columns );
@columnAdjust: ( ( ( @columns - 1 ) * @gutter-size ) / @columns ) ;
vertical-align: top;
display: inline-block;
margin-left: @gutter-size;
width: calc( ~"@{responsiveColumn}% - @{columnAdjust}" ) ;
&:nth-of-type( @{columns}n+1 ){
margin-left: 0;
}
}
.card {
.box-to-grid(3, 3em);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment