Matteo Scandolo | d2044a4 | 2017-08-07 16:08:28 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2017-present Open Networking Foundation |
| 4 | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | |
Matteo Scandolo | 2500e39 | 2016-03-25 17:20:27 -0700 | [diff] [blame] | 19 | // |
| 20 | // Tables |
| 21 | // -------------------------------------------------- |
| 22 | |
| 23 | |
| 24 | table { |
| 25 | background-color: $table-bg; |
| 26 | } |
| 27 | caption { |
| 28 | padding-top: $table-cell-padding; |
| 29 | padding-bottom: $table-cell-padding; |
| 30 | color: $text-muted; |
| 31 | text-align: left; |
| 32 | } |
| 33 | th { |
| 34 | text-align: left; |
| 35 | } |
| 36 | |
| 37 | |
| 38 | // Baseline styles |
| 39 | |
| 40 | .table { |
| 41 | width: 100%; |
| 42 | max-width: 100%; |
| 43 | margin-bottom: $line-height-computed; |
| 44 | // Cells |
| 45 | > thead, |
| 46 | > tbody, |
| 47 | > tfoot { |
| 48 | > tr { |
| 49 | > th, |
| 50 | > td { |
| 51 | padding: $table-cell-padding; |
| 52 | line-height: $line-height-base; |
| 53 | vertical-align: top; |
| 54 | border-top: 1px solid $table-border-color; |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | // Bottom align for column headings |
| 59 | > thead > tr > th { |
| 60 | vertical-align: bottom; |
| 61 | border-bottom: 2px solid $table-border-color; |
| 62 | } |
| 63 | // Remove top border from thead by default |
| 64 | > caption + thead, |
| 65 | > colgroup + thead, |
| 66 | > thead:first-child { |
| 67 | > tr:first-child { |
| 68 | > th, |
| 69 | > td { |
| 70 | border-top: 0; |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | // Account for multiple tbody instances |
| 75 | > tbody + tbody { |
| 76 | border-top: 2px solid $table-border-color; |
| 77 | } |
| 78 | |
| 79 | // Nesting |
| 80 | .table { |
| 81 | background-color: $body-bg; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | |
| 86 | // Condensed table w/ half padding |
| 87 | |
| 88 | .table-condensed { |
| 89 | > thead, |
| 90 | > tbody, |
| 91 | > tfoot { |
| 92 | > tr { |
| 93 | > th, |
| 94 | > td { |
| 95 | padding: $table-condensed-cell-padding; |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | |
| 102 | // Bordered version |
| 103 | // |
| 104 | // Add borders all around the table and between all the columns. |
| 105 | |
| 106 | .table-bordered { |
| 107 | border: 1px solid $table-border-color; |
| 108 | > thead, |
| 109 | > tbody, |
| 110 | > tfoot { |
| 111 | > tr { |
| 112 | > th, |
| 113 | > td { |
| 114 | border: 1px solid $table-border-color; |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | > thead > tr { |
| 119 | > th, |
| 120 | > td { |
| 121 | border-bottom-width: 2px; |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | |
| 127 | // Zebra-striping |
| 128 | // |
| 129 | // Default zebra-stripe styles (alternating gray and transparent backgrounds) |
| 130 | |
| 131 | .table-striped { |
| 132 | > tbody > tr:nth-of-type(odd) { |
| 133 | background-color: $table-bg-accent; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | |
| 138 | // Hover effect |
| 139 | // |
| 140 | // Placed here since it has to come after the potential zebra striping |
| 141 | |
| 142 | .table-hover { |
| 143 | > tbody > tr:hover { |
| 144 | background-color: $table-bg-hover; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | |
| 149 | // Table cell sizing |
| 150 | // |
| 151 | // Reset default table behavior |
| 152 | |
| 153 | table col[class*="col-"] { |
| 154 | position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623) |
| 155 | float: none; |
| 156 | display: table-column; |
| 157 | } |
| 158 | table { |
| 159 | td, |
| 160 | th { |
| 161 | &[class*="col-"] { |
| 162 | position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623) |
| 163 | float: none; |
| 164 | display: table-cell; |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | |
| 170 | // Table backgrounds |
| 171 | // |
| 172 | // Exact selectors below required to override `.table-striped` and prevent |
| 173 | // inheritance to nested tables. |
| 174 | |
| 175 | // Generate the contextual variants |
| 176 | @include table-row-variant('active', $table-bg-active); |
| 177 | @include table-row-variant('success', $state-success-bg); |
| 178 | @include table-row-variant('info', $state-info-bg); |
| 179 | @include table-row-variant('warning', $state-warning-bg); |
| 180 | @include table-row-variant('danger', $state-danger-bg); |
| 181 | |
| 182 | |
| 183 | // Responsive tables |
| 184 | // |
| 185 | // Wrap your tables in `.table-responsive` and we'll make them mobile friendly |
| 186 | // by enabling horizontal scrolling. Only applies <768px. Everything above that |
| 187 | // will display normally. |
| 188 | |
| 189 | .table-responsive { |
| 190 | overflow-x: auto; |
| 191 | min-height: 0.01%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837) |
| 192 | |
| 193 | @media screen and (max-width: $screen-xs-max) { |
| 194 | width: 100%; |
| 195 | margin-bottom: ($line-height-computed * 0.75); |
| 196 | overflow-y: hidden; |
| 197 | -ms-overflow-style: -ms-autohiding-scrollbar; |
| 198 | border: 1px solid $table-border-color; |
| 199 | |
| 200 | // Tighten up spacing |
| 201 | > .table { |
| 202 | margin-bottom: 0; |
| 203 | |
| 204 | // Ensure the content doesn't wrap |
| 205 | > thead, |
| 206 | > tbody, |
| 207 | > tfoot { |
| 208 | > tr { |
| 209 | > th, |
| 210 | > td { |
| 211 | white-space: nowrap; |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | // Special overrides for the bordered tables |
| 218 | > .table-bordered { |
| 219 | border: 0; |
| 220 | |
| 221 | // Nuke the appropriate borders so that the parent can handle them |
| 222 | > thead, |
| 223 | > tbody, |
| 224 | > tfoot { |
| 225 | > tr { |
| 226 | > th:first-child, |
| 227 | > td:first-child { |
| 228 | border-left: 0; |
| 229 | } |
| 230 | > th:last-child, |
| 231 | > td:last-child { |
| 232 | border-right: 0; |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | // Only nuke the last row's bottom-border in `tbody` and `tfoot` since |
| 238 | // chances are there will be only one `tr` in a `thead` and that would |
| 239 | // remove the border altogether. |
| 240 | > tbody, |
| 241 | > tfoot { |
| 242 | > tr:last-child { |
| 243 | > th, |
| 244 | > td { |
| 245 | border-bottom: 0; |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | } |
| 251 | } |
| 252 | } |