Skip to content

Instantly share code, notes, and snippets.

@pwartbichler
Created November 12, 2013 09:05
Show Gist options
  • Save pwartbichler/7427805 to your computer and use it in GitHub Desktop.
Save pwartbichler/7427805 to your computer and use it in GitHub Desktop.
Globales Tabellenstyling via Bootstrap
table {
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
background-color: transparent;
width: 100%;
margin-bottom: 20px;
}
table > thead > tr > th,
table > tbody > tr > th,
table > tfoot > tr > th,
table > thead > tr > td,
table > tbody > tr > td,
table > tfoot > tr > td {
padding: 8px;
line-height: 1.428571429;
vertical-align: top;
border-top: 1px solid #dddddd;
}
table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #dddddd;
}
table > caption + thead > tr:first-child > th,
table > colgroup + thead > tr:first-child > th,
table > thead:first-child > tr:first-child > th,
table > caption + thead > tr:first-child > td,
table > colgroup + thead > tr:first-child > td,
table > thead:first-child > tr:first-child > td {
border-top: 0;
}
table > tbody + tbody {
border-top: 2px solid #dddddd;
}
table {
background-color: #ffffff;
}
table > thead > tr > th,
table > tbody > tr > th,
table > tfoot > tr > th,
table > thead > tr > td,
table > tbody > tr > td,
table > tfoot > tr > td {
padding: 5px;
}
table > thead > tr > th,
table > thead > tr > td {
border-bottom-width: 2px;
}
table > tbody > tr:nth-child(odd) > td,
table > tbody > tr:nth-child(odd) > th {
background-color: #f9f9f9;
}
table > tbody > tr:hover > td,
table > tbody > tr:hover > th {
background-color: #f5f5f5;
}
table col[class*="col-"] {
float: none;
display: table-column;
}
table td[class*="col-"],
table th[class*="col-"] {
float: none;
display: table-cell;
}
@media (max-width: 767px) {
table {
width: 100%;
margin-bottom: 15px;
overflow-y: hidden;
overflow-x: scroll;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #dddddd;
-webkit-overflow-scrolling: touch;
}
.table-responsive > .table {
margin-bottom: 0;
}
table > thead > tr > th,
table > tbody > tr > th,
table > tfoot > tr > th,
table > thead > tr > td,
table > tbody > tr > td,
table > tfoot > tr > td {
white-space: nowrap;
}
table > .table-bordered {
border: 0;
}
table > thead > tr > th:first-child,
table > tbody > tr > th:first-child,
table > tfoot > tr > th:first-child,
table > thead > tr > td:first-child,
table > tbody > tr > td:first-child,
table > tfoot > tr > td:first-child {
border-left: 0;
}
table > thead > tr > th:last-child,
table > tbody > tr > th:last-child,
table > tfoot > tr > th:last-child,
table > thead > tr > td:last-child,
table > tbody > tr > td:last-child,
table > tfoot > tr > td:last-child {
border-right: 0;
}
table > tbody > tr:last-child > th,
table > tfoot > tr:last-child > th,
table > tbody > tr:last-child > td,
table > tfoot > tr:last-child > td {
border-bottom: 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment