diff options
| author | Mark Otto <[email protected]> | 2016-11-26 02:03:12 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-11-26 02:03:12 -0800 |
| commit | b9947152c67ff92f4ba9a8abf4c7ebbafef1b1fa (patch) | |
| tree | 5a1f523d26921741abf5b2c2b21302ab58dbca5d | |
| parent | 8cd29af7ee12d3a684374636bc75078c8b401c4c (diff) | |
| parent | b88c32cf17a7976e12a4dc077389eb71d42df8ca (diff) | |
| download | bootstrap-b9947152c67ff92f4ba9a8abf4c7ebbafef1b1fa.tar.xz bootstrap-b9947152c67ff92f4ba9a8abf4c7ebbafef1b1fa.zip | |
Merge pull request #21208 from twbs/table-responsive-docs
Update .table-responsive
| -rw-r--r-- | docs/content/tables.md | 274 | ||||
| -rw-r--r-- | scss/_tables.scss | 13 |
2 files changed, 140 insertions, 147 deletions
diff --git a/docs/content/tables.md b/docs/content/tables.md index b927f35d5..c1661e532 100644 --- a/docs/content/tables.md +++ b/docs/content/tables.md @@ -442,52 +442,50 @@ Add `.table-sm` to make tables more compact by cutting cell padding in half. Use contextual classes to color table rows or individual cells. -<div class="table-responsive"> - <table class="table table-bordered table-striped"> - <colgroup> - <col class="col-1"> - <col class="col-7"> - </colgroup> - <thead> - <tr> - <th>Class</th> - <th>Description</th> - </tr> - </thead> - <tbody> - <tr> - <th scope="row"> - <code>.table-active</code> - </th> - <td>Applies the hover color to a particular row or cell</td> - </tr> - <tr> - <th scope="row"> - <code>.table-success</code> - </th> - <td>Indicates a successful or positive action</td> - </tr> - <tr> - <th scope="row"> - <code>.table-info</code> - </th> - <td>Indicates a neutral informative change or action</td> - </tr> - <tr> - <th scope="row"> - <code>.table-warning</code> - </th> - <td>Indicates a warning that might need attention</td> - </tr> - <tr> - <th scope="row"> - <code>.table-danger</code> - </th> - <td>Indicates a dangerous or potentially negative action</td> - </tr> - </tbody> - </table> -</div> +<table class="table table-bordered table-striped table-responsive"> + <colgroup> + <col class="col-1"> + <col class="col-7"> + </colgroup> + <thead> + <tr> + <th>Class</th> + <th>Description</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row"> + <code>.table-active</code> + </th> + <td>Applies the hover color to a particular row or cell</td> + </tr> + <tr> + <th scope="row"> + <code>.table-success</code> + </th> + <td>Indicates a successful or positive action</td> + </tr> + <tr> + <th scope="row"> + <code>.table-info</code> + </th> + <td>Indicates a neutral informative change or action</td> + </tr> + <tr> + <th scope="row"> + <code>.table-warning</code> + </th> + <td>Indicates a warning that might need attention</td> + </tr> + <tr> + <th scope="row"> + <code>.table-danger</code> + </th> + <td>Indicates a dangerous or potentially negative action</td> + </tr> + </tbody> +</table> <div class="bd-example"> <table class="table"> @@ -670,7 +668,7 @@ Regular table background variants are not available with the inverse table, howe ## Responsive tables -Create responsive tables by wrapping any `.table` in `.table-responsive` to make them scroll horizontally on small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables. +Create responsive tables by adding `.table-responsive` to any `.table` to make them scroll horizontally on small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables. {% callout warning %} #### Vertical clipping/truncation @@ -693,103 +691,97 @@ For more information, read [this Stack Overflow answer](https://stackoverflow.co {% endcallout %} <div class="bd-example"> - <div class="table-responsive"> - <table class="table"> - <thead> - <tr> - <th>#</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - </tr> - </thead> - <tbody> - <tr> - <th scope="row">1</th> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - </tr> - <tr> - <th scope="row">2</th> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - </tr> - <tr> - <th scope="row">3</th> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - </tr> - </tbody> - </table> - </div> - - <div class="table-responsive"> - <table class="table table-bordered"> - <thead> - <tr> - <th>#</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - <th>Table heading</th> - </tr> - </thead> - <tbody> - <tr> - <th scope="row">1</th> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - </tr> - <tr> - <th scope="row">2</th> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - </tr> - <tr> - <th scope="row">3</th> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - <td>Table cell</td> - </tr> - </tbody> - </table> - </div> -</div> + <table class="table table-responsive"> + <thead> + <tr> + <th>#</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">1</th> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + </tr> + <tr> + <th scope="row">2</th> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + </tr> + <tr> + <th scope="row">3</th> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + </tr> + </tbody> + </table> -{% highlight html %} -<div class="table-responsive"> - <table class="table"> - ... + <table class="table table-bordered table-responsive"> + <thead> + <tr> + <th>#</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + <th>Table heading</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">1</th> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + </tr> + <tr> + <th scope="row">2</th> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + </tr> + <tr> + <th scope="row">3</th> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + <td>Table cell</td> + </tr> + </tbody> </table> </div> + +{% highlight html %} +<table class="table table-responsive""> + ... +</table> {% endhighlight %} diff --git a/scss/_tables.scss b/scss/_tables.scss index 89b03e4b1..3d8000045 100644 --- a/scss/_tables.scss +++ b/scss/_tables.scss @@ -136,8 +136,8 @@ // Responsive tables // -// Wrap your tables in `.table-responsive` and we'll make them mobile friendly -// by enabling horizontal scrolling. Only applies <768px. Everything above that +// Add `.table-responsive` to `.table`s and we'll make them mobile friendly by +// enabling horizontal scrolling. Only applies <768px. Everything above that // will display normally. .table-responsive { @@ -145,11 +145,12 @@ width: 100%; min-height: 0%; // Workaround for IE9 bug (see https://github.com/twbs/bootstrap/issues/14837) overflow-x: auto; + -ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057 - // TODO: find out if we need this still. - // - // border: $table-border-width solid $table-border-color; - // -ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057 + // Prevent double border on horizontal scroll due to use of `display: block;` + &.table-bordered { + border: 0; + } } |
