@mixin span-columns($span: $columns of $container-columns, $display: block) {

  $columns: nth($span, 1);
  $container-columns: container-span($span);
  $display-table: false;

  $direction: get-direction($layout-direction, $default-layout-direction);
  $opposite-direction: get-opposite-direction($direction);

  @if $container-columns != $grid-columns {
    $parent-columns: $container-columns;
  } @else {
    $parent-columns: $grid-columns;
  }

  @if $container-display-table == true {
    $display-table: true;
  } @else if $display == table {
    $display-table: true;
  } @else {
    $display-table: false;
  }

  @if $display-table  {
    display: table-cell;
    padding-#{$direction}: flex-gutter($container-columns);
    width: flex-grid($columns, $container-columns) + flex-gutter($container-columns);

    &:last-child {
      width: flex-grid($columns, $container-columns);
      padding-#{$direction}: 0;
    }
  }

  @else {
    display: block;
    float: #{$opposite-direction};
    margin-#{$direction}: flex-gutter($container-columns);
    width: flex-grid($columns, $container-columns);

    &:last-child {
      margin-#{$direction}: 0;
    }
  }
}
