@mixin float-clear($dir) { @if $dir == 'left' { clear: right; } @else if $dir == 'right' { clear: left; } @else if $dir == 'both' { clear: both; } @include clearfix; } @mixin float-common($columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) { @include box-sizing(border-box); *behavior: url("../behaviors/box-sizing/boxsizing.php"); overflow: hidden; *zoom: 1; @if $grouped-styles and $padding != 0 { padding-left: $padding; padding-right: $padding; } @if $grouped-styles == false and $padding != 0 { } } @mixin float-section($span, $location: $grid-counter, $columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) { width: grid-span($span, $location, $columns, $gutter); // add special left padding @include grid-location($span, $location, $columns); @if $dir == ltr or $dir == both { @if $grid-location == 'middle' or $grid-location == 'first'{ float: left; margin-right: gutter-span($gutter, $columns); } @else if $grid-location == 'last' { float: right; } @include float-clear('left'); } @if $dir == rtl { @if $grid-location == 'middle' or $grid-location == 'first' { float: right; margin-left: gutter-span($gutter, $columns); } @else if $grid-location == 'last' { float: left; } @include float-clear('right'); } @if $dir == both { #{$rtl-selector} & { @if $grid-location == 'middle' or $grid-location == 'first' { float: right; margin-left: gutter-span($gutter, $columns); } @else if $grid-location == 'last' { float: left; } @include float-clear('right'); } } // Padding @if type-of($columns) == list { @if type-of(nth($columns, $location)) == list { padding-left: nth(nth($columns, $location), 2); } @else if $padding != 0 { padding-left: $padding; } // add special right padding @if type-of(nth($columns, $location + $span - 1)) == list { padding-right: nth(nth($columns, $location + $span - 1), 2); } @else if $padding != 0 { padding-right: $padding; } } } @mixin float-structure($span, $location, $columns, $gutter, $padding) { // common components @include float-common($columns, $gutter); // specific styles @include float-section($span, $location, $columns, $gutter); }