table:not(.highlight) { // <<< inline border-collapse: collapse; margin-bottom: 2rem; margin-left: -1rem; // >>> // <<< link display: block; vertical-align: top; overflow-x: auto; -webkit-overflow-scrolling: touch; // >>> // <<< inline td, th { padding: .25rem .5rem; border: 1px solid $border-color; &:first-child { padding-left: 1rem; } &:last-child { padding-right: 1rem; } } // >>> // <<< link thead { background-color: $body-bg; } thead + tbody, tbody + tbody, tfoot { border-top: 3px double $border-color; } tbody tr:nth-child(even) td, tbody tr:nth-child(even) th { background-color: $body-bg; } tbody tr:nth-child(odd) td, tbody tr:nth-child(odd) th { background-color: $gray-bg; } // >>> } // <<<<< LINK @media print { table:not(.highlight) { width: 100%!important; } } // CSS only Responsive Tables // http://dbushell.com/2016/03/04/css-only-responsive-tables/ // by David Bushell @mixin scroll-table() { white-space: nowrap; // optional - looks better for small cell values } @mixin flip-table() { display: flex; overflow: hidden; thead, thead + tbody, tbody + tbody { border-top: 1px solid $border-color; border-bottom: 1px solid $border-color; } thead, tbody { display: flex; } thead { flex-shrink: 0; min-width: min-content; th { padding-left: 1rem; } } tbody { position: relative; overflow-x: auto; overflow-y: hidden; padding-left: 1px; -webkit-overflow-scrolling: touch; } tr { display: flex; flex-direction: column; min-width: min-content; flex-shrink: 0; td { border-left: none; } &:first-child { td { border-left: 1px solid $border-color; } } &:last-child { td { padding-right: 1rem; border-right: 1px solid $border-color; } } } td, th { display: block; border-bottom: none; &:first-child { padding-left: .5rem; border-top: none; } &:last-child { padding-right: .5rem; } } } table.stretch-table { display: table; width: 100% !important; width: calc(100% + 2rem) !important; } table.scroll-table { @include scroll-table(); } table.flip-table { @include flip-table(); } @media screen and (max-width: $break-point-4) { table.scroll-table-small { @include scroll-table(); } table.flip-table-small { @include flip-table(); } } // >>>>> LINK