// Gutter Syntax // ============= // Gutters // ------- // Set gutters on an element. // - [$context] : @mixin gutters( $context: get-grid() ) { $context: get-adjusted-grid($context); $this-columns : get-setting(columns, $context); $this-gutters : get-setting(gutters, $context); $this-column-width : get-setting(column-width, $context); $this-layout-math : get-setting(layout-math, $context); $this-gutter-position : get-setting(gutter-position, $context); $this-flow : get-setting(flow, $context); $from: from($this-flow); $to: to($this-flow); $this-gutters: get-gutters($this-columns, $this-gutters, $this-column-width, $this-layout-math, $this-gutter-position); $property: if($this-gutter-position == inside, padding, margin); #{$property}-#{$from}: nth($this-gutters, 1); #{$property}-#{$to}: nth($this-gutters, 2); } // Gutter // ------ // Return the width of a gutter. // - [$context] : @function gutter( $context: get-grid() ) { $context : get-adjusted-grid($context); $this-columns : get-setting(columns, $context); $this-gutters : get-setting(gutters, $context); $this-column-width : get-setting(column-width, $context); $this-layout-math : get-setting(layout-math, $context); $this-gutter-position : get-setting(gutter-position, $context); $width: get-gutter-width($this-columns, $this-gutters, $this-column-width, $this-layout-math); @if $this-gutter-position == inside or $this-gutter-position == split { $width: $width / 2; } @return $width; } // Get Gutter Width // ---------------- // Return gutter width. // - [$columns] : | // - [$gutters] : // - [$column-width] : // - [$layout-math] : fluid | static @function get-gutter-width( $columns : $columns, $gutters : $gutters, $column-width : $column-width, $layout-math : $layout-math ) { $context : column-sum($columns, $gutters); $gutter : null; @if $layout-math == static { $gutter: $gutters * $column-width; } @else { $gutter: percentage($gutters / $context); } @return $gutter; } // Get Gutters // ----------- // Return before and after gutter values. // - [$columns] : | // - [$gutters] : // - [$column-width] : // - [$layout-math] : fluid | static // - [$gutter-position] : before | after |split | inside // - [$gutter-override] : @function get-gutters( $columns : $columns, $gutters : $gutters, $column-width : $column-width, $layout-math : $layout-math, $gutter-position : $gutter-position, $gutter-override : false ) { $gutter : null; $before : null; $after : null; @if $gutter-override { $gutter: $gutter-override; } @else { $gutter: get-gutter-width($columns, $gutters, $column-width, $layout-math); } @if $gutter-position == before { $before: $gutter; } @else if $gutter-position == after { $after: $gutter; } @else if $gutter-position == split or $gutter-position == inside { $gutter: if($gutter-override, $gutter, $gutter / 2); $before: $gutter; $after: $gutter; } @return $before $after; }