Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <table class="table-flip-sm">
  <thead>
    <tr>
      <th>Name</th>
      <th>Life Accomplishment</th>
      <th>Role</th>
      <th>Status</th>
      <th>Favorite Color</th>
      <th>Creation Date</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Kevin Shelley</td>
      <td class="max-md-4">Broke 46 toilets on his head in one minute.</td>
      <td>Admin</td>
      <td>Locked</td>
      <td>Red</td>
      <td>11/01/2017 12:00 AM</td>
    </tr>
    <tr>
      <td>Olga Liashchuk</td>
      <td class="max-md-4">Holds the world record for fastest time for crushing 3 watermellons with your thights (14.65 seconds)</td>
      <td>Editor</td>
      <td>Disabled</td>
      <td>Carnelian</td>
      <td>11/03/2017 12:44 AM</td>
    </tr>
    <tr>
      <td>Paul Prado</td>
      <td class="max-md-4">Blew a mashmallow out of his nose to an impressive distance of 17 ft 11 in.</td>
      <td>Admin</td>
      <td></td>
      <td>Orange</td>
      <td>12/05/2018 01:00 PM</td>
    </tr>
    <tr>
      <td>Tester McTesterson</td>
      <td class="max-md-4">Someonereallydoesn'tliketousespacesintheirsentences.</td>
      <td>Tester</td>
      <td>Testing</td>
      <td>Orange</td>
      <td>01/01/1970 00:00 AM</td>
    </tr>
  </tbody>
</table>
              
            
!

CSS

              
                // variables
$grid-breakpoints: (
  xs: 0,
  sm: 576px,
  md: 768px,
  lg: 992px,
  xl: 1200px
);

// stolen from bootstrap (https://github.com/twbs/bootstrap/blob/v4-dev/scss/mixins/_breakpoints.scss)
@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
  $n: index($breakpoint-names, $name);
  @return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
}
@function breakpoint-min($name, $breakpoints: $grid-breakpoints) {
  $min: map-get($breakpoints, $name);
  @return if($min != 0, $min, null);
}
@function breakpoint-max($name, $breakpoints: $grid-breakpoints) {
  $next: breakpoint-next($name, $breakpoints);
  @return if($next, breakpoint-min($next, $breakpoints) - 1px, null);
}
@function breakpoint-infix($name, $breakpoints: $grid-breakpoints) {
  @return if(breakpoint-min($name, $breakpoints) == null, "", "-#{$name}");
}
@mixin media-breakpoint-up($name, $breakpoints: $grid-breakpoints) {
  $min: breakpoint-min($name, $breakpoints);
  @if $min {
    @media (min-width: $min) {
      @content;
    }
  } @else {
    @content;
  }
}
@mixin media-breakpoint-down($name, $breakpoints: $grid-breakpoints) {
  $max: breakpoint-max($name, $breakpoints);
  @if $max {
    @media (max-width: $max) {
      @content;
    }
  } @else {
    @content;
  }
}

// text sizing
$sizes: (
    1: 5,
    2: 10,
    3: 15,
    4: 20,
    5: 25,
    'auto': 0
);

@each $breakpoint in map-keys($grid-breakpoints) {
    @include media-breakpoint-up($breakpoint) {
        $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
        @each $key, $value in $sizes {
            .max#{$infix}-#{$key} {
                @if $value > 0 {
                    max-width: $value * 1vw;
                }
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
    }
}

// table flipping
@mixin table-flip {
    display: flex;
    flex-direction: row;
    border: 1px solid rgba(0, 0, 0, 0.1);

    thead{
        display: flex;
        flex-direction: row;

        th {
            display: flex;
            flex-direction: column;
            border-right: 1px solid rgba(0, 0, 0, 0.1);
            border-bottom: none;
            max-width: 13rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;

            .sort-wrap, .title {
                flex-grow: 1;
            }

            .title {
                display: inline-block;
                max-width: 8rem;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            .filters {
                display: none;
            }
        }

        tr th:first-child {
            border-top: none;
        }

        tr th:last-child {
            flex-grow: 1;
        }
    }

    tbody {
        display: flex;
        flex-direction: row;
        flex-grow: 1;
        overflow-y: auto;

        tr:nth-child(odd) {
            background-color: rgba(0, 0, 0, 0.05);
        }

        tr:last-child td {
            border-bottom: none;
        }

        tr td:first-child {
            border-top: none;
        }

        td {
            display: inline-block;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            // to ensure that the cell takes up the full width available
            min-width: 100%;
        }
    }

    tr {
        display: flex;
        flex-direction: column;
        max-width: 100%;
        flex-grow: 1;
    }

    td, th {
        min-height: 3rem;
    }

    .fit-to-content {
        width: auto;
    }
}

table.table-flip {
    @include table-flip;
}

// create responsive tables up to a particular breakpoint "table.table-flip{-sm|-md|-lg|-xl}"
@each $breakpoint in map-keys($grid-breakpoints) {
    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);

    @include media-breakpoint-down($breakpoint) {
        table.table-flip#{$infix} {
            @include table-flip;
        }
    }
}

// demo styles
th { text-align: left; }
              
            
!

JS

              
                
              
            
!
999px

Console