Skip to content

Instantly share code, notes, and snippets.

@jtrain
Created January 4, 2012 09:42
Show Gist options
  • Save jtrain/1559336 to your computer and use it in GitHub Desktop.
Save jtrain/1559336 to your computer and use it in GitHub Desktop.
Tables styles from bootstrap
<style>
table {
width: 100%;
margin-bottom: 18px;
padding: 0;
font-size: 13px;
border-collapse: collapse;
}
table th, table td {
padding: 10px 10px 9px;
line-height: 18px;
text-align: left;
}
table th {
padding-top: 9px;
font-weight: bold;
vertical-align: middle;
}
table td {
vertical-align: top;
border-top: 1px solid #ddd;
}
table tbody th {
border-top: 1px solid #ddd;
vertical-align: top;
}
.condensed-table th, .condensed-table td {
padding: 5px 5px 4px;
}
.bordered-table {
border: 1px solid #ddd;
border-collapse: separate;
*border-collapse: collapse;
/* IE7, collapse table to remove spacing */
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.bordered-table th + th, .bordered-table td + td, .bordered-table th + td {
border-left: 1px solid #ddd;
}
.bordered-table thead tr:first-child th:first-child, .bordered-table tbody tr:first-child td:first-child {
-webkit-border-radius: 4px 0 0 0;
-moz-border-radius: 4px 0 0 0;
border-radius: 4px 0 0 0;
}
.bordered-table thead tr:first-child th:last-child, .bordered-table tbody tr:first-child td:last-child {
-webkit-border-radius: 0 4px 0 0;
-moz-border-radius: 0 4px 0 0;
border-radius: 0 4px 0 0;
}
.bordered-table tbody tr:last-child td:first-child {
-webkit-border-radius: 0 0 0 4px;
-moz-border-radius: 0 0 0 4px;
border-radius: 0 0 0 4px;
}
.bordered-table tbody tr:last-child td:last-child {
-webkit-border-radius: 0 0 4px 0;
-moz-border-radius: 0 0 4px 0;
border-radius: 0 0 4px 0;
}
table .span1 {
width: 20px;
}
table .span2 {
width: 60px;
}
table .span3 {
width: 100px;
}
table .span4 {
width: 140px;
}
table .span5 {
width: 180px;
}
table .span6 {
width: 220px;
}
table .span7 {
width: 260px;
}
table .span8 {
width: 300px;
}
table .span9 {
width: 340px;
}
table .span10 {
width: 380px;
}
table .span11 {
width: 420px;
}
table .span12 {
width: 460px;
}
table .span13 {
width: 500px;
}
table .span14 {
width: 540px;
}
table .span15 {
width: 580px;
}
table .span16 {
width: 620px;
}
.zebra-striped tbody tr:nth-child(odd) td, .zebra-striped tbody tr:nth-child(odd) th {
background-color: #f9f9f9;
}
.zebra-striped tbody tr:hover td, .zebra-striped tbody tr:hover th {
background-color: #f5f5f5;
}
table .header {
cursor: pointer;
}
table .header:after {
content: "";
float: right;
margin-top: 7px;
border-width: 0 4px 4px;
border-style: solid;
border-color: #000 transparent;
visibility: hidden;
}
table .headerSortUp, table .headerSortDown {
background-color: rgba(141, 192, 219, 0.25);
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
}
table .header:hover:after {
visibility: visible;
}
table .headerSortDown:after, table .headerSortDown:hover:after {
visibility: visible;
filter: alpha(opacity=60);
-khtml-opacity: 0.6;
-moz-opacity: 0.6;
opacity: 0.6;
}
table .headerSortUp:after {
border-bottom: none;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid #000;
visibility: visible;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
filter: alpha(opacity=60);
-khtml-opacity: 0.6;
-moz-opacity: 0.6;
opacity: 0.6;
}
table .blue {
color: #049cdb;
border-bottom-color: #049cdb;
}
table .headerSortUp.blue, table .headerSortDown.blue {
background-color: #ade6fe;
}
table .green {
color: #46a546;
border-bottom-color: #46a546;
}
table .headerSortUp.green, table .headerSortDown.green {
background-color: #cdeacd;
}
table .red {
color: #9d261d;
border-bottom-color: #9d261d;
}
table .headerSortUp.red, table .headerSortDown.red {
background-color: #f4c8c5;
}
table .yellow {
color: #ffc40d;
border-bottom-color: #ffc40d;
}
table .headerSortUp.yellow, table .headerSortDown.yellow {
background-color: #fff6d9;
}
table .orange {
color: #f89406;
border-bottom-color: #f89406;
}
table .headerSortUp.orange, table .headerSortDown.orange {
background-color: #fee9cc;
}
table .purple {
color: #7a43b6;
border-bottom-color: #7a43b6;
}
table .headerSortUp.purple, table .headerSortDown.purple {
background-color: #e2d5f0;
}
</style>
<table class="zebra-striped">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Language</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Some</td>
<td>One</td>
<td>English</td>
</tr>
<tr>
<td>2</td>
<td>Joe</td>
<td>Sixpack</td>
<td>English</td>
</tr>
<tr>
<td>3</td>
<td>Stu</td>
<td>Dent</td>
<td>Code</td>
</tr>
<tr>
<td colspan="4">
span 4 columns
</td>
</tr>
<tr>
<td colspan="2">
span 2 columns
</td>
<td colspan="2">
span 2 columns
</td>
</tr>
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment