1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/lib/tables.less

228 lines
4.9 KiB
Text
Raw Normal View History

//
// Tables.less
// Tables for, you guessed it, tabular data
// ----------------------------------------
2011-05-03 21:09:25 -04:00
2011-08-17 01:58:01 -04:00
// BASELINE STYLES
// ---------------
2011-05-03 21:09:25 -04:00
table {
width: 100%;
margin-bottom: @baseLineHeight;
}
th,
td {
padding: 8px;
line-height: @baseLineHeight;
text-align: left;
border-top: 1px solid #ddd;
}
th {
font-weight: bold;
vertical-align: bottom;
}
td {
vertical-align: top;
}
// CONDENSED TABLE W/ HALF PADDING
// -------------------------------
.condensed-table {
th,
td {
padding: 4px 5px;
}
}
// BORDERED VERSION
// ----------------
.bordered-table {
border: 1px solid #ddd;
border-collapse: separate; // Done so we can round those corners!
.border-radius(4px);
th + th,
td + td,
th + td,
td + th {
border-left: 1px solid #ddd;
}
// Prevent a double border
thead:first-child tr:first-child th,
tbody:first-child tr:first-child td {
border-top: 0;
}
// For first th or td in the first row in the first thead or tbody
thead:first-child tr:first-child th:first-child,
tbody:first-child tr:first-child td:first-child {
.border-radius(4px 0 0 0);
}
thead:first-child tr:first-child th:last-child,
tbody:first-child tr:first-child td:last-child {
.border-radius(0 4px 0 0);
}
// For first th or td in the first row in the first thead or tbody
thead:last-child tr:last-child th:first-child,
tbody:last-child tr:last-child td:first-child {
.border-radius(0 0 0 4px);
}
thead:last-child tr:last-child th:last-child,
tbody:last-child tr:last-child td:last-child {
.border-radius(0 0 4px 0);
}
2011-05-03 21:09:25 -04:00
}
// ZEBRA-STRIPING
// --------------
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.striped-table {
tbody {
tr:nth-child(odd) td,
tr:nth-child(odd) th {
background-color: #f9f9f9;
}
}
}
/*
// ----------------
// This is a duplication of the main grid .columns() mixin, but subtracts 20px to account for input padding and border
.tableColumns(@columnSpan: 1) {
width: ((@gridColumnWidth - 20) * @columnSpan) + ((@gridColumnWidth - 20) * (@columnSpan - 1));
}
table {
// Default columns
.span1 { .tableColumns(1); }
.span2 { .tableColumns(2); }
.span3 { .tableColumns(3); }
.span4 { .tableColumns(4); }
.span5 { .tableColumns(5); }
.span6 { .tableColumns(6); }
.span7 { .tableColumns(7); }
.span8 { .tableColumns(8); }
.span9 { .tableColumns(9); }
.span10 { .tableColumns(10); }
.span11 { .tableColumns(11); }
.span12 { .tableColumns(12); }
.span13 { .tableColumns(13); }
.span14 { .tableColumns(14); }
.span15 { .tableColumns(15); }
.span16 { .tableColumns(16); }
}
// TABLESORTER
// -----------
table {
2011-05-03 21:09:25 -04:00
// Tablesorting styles w/ jQuery plugin
.header {
2011-05-03 21:09:25 -04:00
cursor: pointer;
&:after {
float: right;
margin-top: 7px;
border-width: 0 4px 4px;
border-style: solid;
border-color: #000 transparent;
content: "";
visibility: hidden;
}
2011-05-03 21:09:25 -04:00
}
2011-08-17 01:58:01 -04:00
// Style the sorted column headers (THs)
.headerSortUp,
.headerSortDown {
2011-05-03 21:09:25 -04:00
text-shadow: 0 1px 1px rgba(255,255,255,.75);
background-color: rgba(141,192,219,.25);
2011-05-03 21:09:25 -04:00
}
2011-08-17 01:58:01 -04:00
// Style the ascending (reverse alphabetical) column header
.header:hover {
&:after {
visibility: visible;
}
2011-05-03 21:09:25 -04:00
}
2011-08-17 01:58:01 -04:00
// Style the descending (alphabetical) column header
.headerSortDown,
.headerSortDown:hover {
&:after {
visibility: visible;
.opacity(60);
}
2011-05-03 21:09:25 -04:00
}
2011-08-17 01:58:01 -04:00
// Style the ascending (reverse alphabetical) column header
.headerSortUp {
&:after {
border-bottom: none;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid #000;
visibility:visible;
.box-shadow(none); //can't add boxshadow to downward facing arrow :(
.opacity(60);
}
2011-05-03 21:09:25 -04:00
}
// Blue Table Headings
.blue {
2011-05-03 21:09:25 -04:00
color: @blue;
border-bottom-color: @blue;
}
.headerSortUp.blue,
.headerSortDown.blue {
2011-05-03 21:09:25 -04:00
background-color: lighten(@blue, 40%);
}
// Green Table Headings
.green {
2011-05-03 21:09:25 -04:00
color: @green;
border-bottom-color: @green;
}
.headerSortUp.green,
.headerSortDown.green {
2011-05-03 21:09:25 -04:00
background-color: lighten(@green, 40%);
}
// Red Table Headings
.red {
2011-05-03 21:09:25 -04:00
color: @red;
border-bottom-color: @red;
}
.headerSortUp.red,
.headerSortDown.red {
2011-05-03 21:09:25 -04:00
background-color: lighten(@red, 50%);
}
// Yellow Table Headings
.yellow {
2011-05-03 21:09:25 -04:00
color: @yellow;
border-bottom-color: @yellow;
}
.headerSortUp.yellow,
.headerSortDown.yellow {
2011-05-03 21:09:25 -04:00
background-color: lighten(@yellow, 40%);
}
// Orange Table Headings
.orange {
2011-05-03 21:09:25 -04:00
color: @orange;
border-bottom-color: @orange;
}
.headerSortUp.orange,
.headerSortDown.orange {
2011-05-03 21:09:25 -04:00
background-color: lighten(@orange, 40%);
}
// Purple Table Headings
.purple {
2011-05-03 21:09:25 -04:00
color: @purple;
border-bottom-color: @purple;
}
.headerSortUp.purple,
.headerSortDown.purple {
2011-05-03 21:09:25 -04:00
background-color: lighten(@purple, 40%);
}
}*/