@each $breakpoint in map-keys($grid-breakpoints) {
  $sides:                                                   (top, right, bottom, left);

  @include media-breakpoint-up($breakpoint) {
    $infix:                                                 breakpoint-infix($breakpoint, $grid-breakpoints);

    @each $side in $sides {
      .border#{$infix}-#{$side},
      .border#{$infix} {
        border-#{$side}:                                    $border-width solid $border-color !important;
      }
      .border#{$infix}-#{$side}-0,
      .border#{$infix}-0 {
        border-#{$side}:                                    0 !important;
      }
      .border-double#{$infix} {
        border:                                             $border-width * 4 double $border-color !important;
      }
    }

    .border#{$infix}-x {
      border-left:                                          $border-width solid $border-color !important;
      border-right:                                         $border-width solid $border-color !important;
    }

    .border#{$infix}-y {
      border-top:                                           $border-width solid $border-color !important;
      border-bottom:                                        $border-width solid $border-color !important;
    }

    .border#{$infix}-x-0 {
      border-left:                                          0 !important;
      border-right:                                         0 !important;
    }

    .border#{$infix}-y-0 {
      border-top:                                           0 !important;
      border-bottom:                                        0 !important;
    }
  }

  @include media-breakpoint-down($breakpoint) {
    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);

    @each $side in $sides {
      .border#{$infix}-d-#{$side},
      .border#{$infix}-d {
        border-#{$side}:                                    $border-width solid $border-color !important;
      }
      .border#{$infix}-d-#{$side}-0,
      .border#{$infix}-d-0 {
        border-#{$side}:                                    0 !important;
      }
      .border-double#{$infix}-d {
        border:                                             $border-width * 4 double $border-color !important;
      }
    }

    .border#{$infix}-d-x {
      border-left:                                          $border-width solid $border-color !important;
      border-right:                                         $border-width solid $border-color !important;
    }

    .border#{$infix}-d-y {
      border-top:                                           $border-width solid $border-color !important;
      border-bottom:                                        $border-width solid $border-color !important;
    }

    .border#{$infix}-d-x-0 {
      border-left:                                          0 !important;
      border-right:                                         0 !important;
    }

    .border#{$infix}-d-y-0 {
      border-top:                                           0 !important;
      border-bottom:                                        0 !important;
    }
  }
}

.border-double         { border: $border-width * 4 double $border-color !important; }
.border-double-top     { border-top: $border-width * 4 double $border-color !important; }
.border-double-right   { border-right: $border-width * 4 double $border-color !important; }
.border-double-bottom  { border-bottom: $border-width * 4 double $border-color !important; }
.border-double-left    { border-left: $border-width * 4 double $border-color !important; }

.border-top-double     { border-top-style: double !important; }
.border-right-double   { border-right-style: double !important; }
.border-bottom-double  { border-bottom-style: double !important; }
.border-left-double    { border-left-style: double !important; }

.border-dashed         { border: $border-width dashed $border-color !important; }
.border-dashed-top     { border-top: $border-width dashed $border-color !important; }
.border-dashed-right   { border-right: $border-width dashed $border-color !important; }
.border-dashed-bottom  { border-bottom: $border-width dashed $border-color !important; }
.border-dashed-left    { border-left: $border-width dashed $border-color !important; }

.border-top-dashed     { border-top-style: dashed !important; }
.border-right-dashed   { border-right-style: dashed !important; }
.border-bottom-dashed  { border-bottom-style: dashed !important; }
.border-left-dashed    { border-left-style: dashed !important; }

@mixin no-border() {
  border:                                                 none !important;

  tr {
    border:                                                 none !important;
  }
  td {
    border:                                                 none !important;
  }
}

@each $breakpoint in map-keys($grid-breakpoints) {
  $infix: breakpoint-infix($breakpoint, $grid-breakpoints);

  @include media-breakpoint-up($breakpoint) {
    .table.no-border#{$infix} {
      @include                                              no-border();
    }
  }
  @include media-breakpoint-down($breakpoint) {
    .table.no-border#{$infix}-d {
      @include                                              no-border();
    }
  }
}