tables.less 4.89 KB
Newer Older
1
2
/*
 * Tables.less
3
 * Tables for, you guessed it, tabular data
4
 * ---------------------------------------- */
Jacob Thornton's avatar
Jacob Thornton committed
5

6

7
8
// BASELINE STYLES
// ---------------
Jacob Thornton's avatar
Jacob Thornton committed
9
10
11
12

table {
  width: 100%;
  padding: 0;
13
  margin-bottom: @baseLineHeight;
14
  font-size: @baseFontSize;
15
16
17
  border-collapse: collapse;
  th,
  td {
Jacob Thornton's avatar
Jacob Thornton committed
18
    padding: 10px 10px 9px;
19
    line-height: @baseLineHeight;
20
    text-align: left;
Jacob Thornton's avatar
Jacob Thornton committed
21
22
23
24
  }
  th {
    padding-top: 9px;
    font-weight: bold;
25
    vertical-align: middle;
Jacob Thornton's avatar
Jacob Thornton committed
26
  }
27
28
  td {
    vertical-align: top;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    border-top: 1px solid #ddd;
  }
  // When scoped to row, fix th in tbody
  tbody th {
    border-top: 1px solid #ddd;
    vertical-align: top;
  }
}


// CONDENSED VERSION
// -----------------

.condensed-table {
  th,
  td {
    padding: 5px 5px 4px;
46
  }
47
48
49
50
51
52
53
54
55
56
57
}


// BORDERED VERSION
// ----------------

.bordered-table {
  border: 1px solid #ddd;
  border-collapse: separate; // Done so we can round those corners!
  *border-collapse: collapse; /* IE7, collapse table to remove spacing */
  .border-radius(4px);
58
  th + th,
59
60
  td + td,
  th + td {
61
62
    border-left: 1px solid #ddd;
  }
63
64
  thead:first-child tr:first-child th:first-child,
  tbody:first-child tr:first-child td:first-child {
65
66
    .border-radius(4px 0 0 0);
  }
67
68
  thead:first-child tr:first-child th:last-child,
  tbody:first-child tr:first-child td:last-child {
69
70
71
72
73
74
75
76
    .border-radius(0 4px 0 0);
  }
  tbody tr:last-child td:first-child {
    .border-radius(0 0 0 4px);
  }
  tbody tr:last-child td:last-child {
    .border-radius(0 0 4px 0);
  }
Jacob Thornton's avatar
Jacob Thornton committed
77
78
}

79

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// ----------------

// 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); }
}


107
108
// ZEBRA-STRIPING
// --------------
Jacob Thornton's avatar
Jacob Thornton committed
109
110

// Default zebra-stripe styles (alternating gray and transparent backgrounds)
111
.striped-table {
Jacob Thornton's avatar
Jacob Thornton committed
112
  tbody {
113
114
    tr:nth-child(odd) td,
    tr:nth-child(odd) th {
115
      background-color: #f9f9f9;
Jacob Thornton's avatar
Jacob Thornton committed
116
    }
117
118
    tr:hover td,
    tr:hover th {
119
      background-color: #f5f5f5;
Jacob Thornton's avatar
Jacob Thornton committed
120
121
    }
  }
122
123
}

124

125
126
127
128
// TABLESORTER
// -----------

table {
Jacob Thornton's avatar
Jacob Thornton committed
129
  // Tablesorting styles w/ jQuery plugin
130
  .header {
Jacob Thornton's avatar
Jacob Thornton committed
131
    cursor: pointer;
132
133
    &:after {
      float: right;
134
135
136
137
      margin-top: 7px;
      border-width: 0 4px 4px;
      border-style: solid;
      border-color: #000 transparent;
138
      content: "";
139
      visibility: hidden;
140
    }
Jacob Thornton's avatar
Jacob Thornton committed
141
  }
142
  // Style the sorted column headers (THs)
143
144
  .headerSortUp,
  .headerSortDown {
Jacob Thornton's avatar
Jacob Thornton committed
145
    text-shadow: 0 1px 1px rgba(255,255,255,.75);
146
    background-color: rgba(141,192,219,.25);
Jacob Thornton's avatar
Jacob Thornton committed
147
  }
148
  // Style the ascending (reverse alphabetical) column header
149
  .header:hover {
150
    &:after {
151
      visibility: visible;
152
    }
Jacob Thornton's avatar
Jacob Thornton committed
153
  }
154
  // Style the descending (alphabetical) column header
155
156
  .headerSortDown,
  .headerSortDown:hover {
157
    &:after {
158
      visibility: visible;
159
160
      .opacity(60);
    }
Jacob Thornton's avatar
Jacob Thornton committed
161
  }
162
  // Style the ascending (reverse alphabetical) column header
163
  .headerSortUp {
164
165
166
167
168
169
170
171
172
    &: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);
    }
Jacob Thornton's avatar
Jacob Thornton committed
173
174
  }
  // Blue Table Headings
175
  .blue {
Jacob Thornton's avatar
Jacob Thornton committed
176
177
178
    color: @blue;
    border-bottom-color: @blue;
  }
179
180
  .headerSortUp.blue,
  .headerSortDown.blue {
Jacob Thornton's avatar
Jacob Thornton committed
181
182
183
    background-color: lighten(@blue, 40%);
  }
  // Green Table Headings
184
  .green {
Jacob Thornton's avatar
Jacob Thornton committed
185
186
187
    color: @green;
    border-bottom-color: @green;
  }
188
189
  .headerSortUp.green,
  .headerSortDown.green {
Jacob Thornton's avatar
Jacob Thornton committed
190
191
192
    background-color: lighten(@green, 40%);
  }
  // Red Table Headings
193
  .red {
Jacob Thornton's avatar
Jacob Thornton committed
194
195
196
    color: @red;
    border-bottom-color: @red;
  }
197
198
  .headerSortUp.red,
  .headerSortDown.red {
Jacob Thornton's avatar
Jacob Thornton committed
199
200
201
    background-color: lighten(@red, 50%);
  }
  // Yellow Table Headings
202
  .yellow {
Jacob Thornton's avatar
Jacob Thornton committed
203
204
205
    color: @yellow;
    border-bottom-color: @yellow;
  }
206
207
  .headerSortUp.yellow,
  .headerSortDown.yellow {
Jacob Thornton's avatar
Jacob Thornton committed
208
209
210
    background-color: lighten(@yellow, 40%);
  }
  // Orange Table Headings
211
  .orange {
Jacob Thornton's avatar
Jacob Thornton committed
212
213
214
    color: @orange;
    border-bottom-color: @orange;
  }
215
216
  .headerSortUp.orange,
  .headerSortDown.orange {
Jacob Thornton's avatar
Jacob Thornton committed
217
218
219
    background-color: lighten(@orange, 40%);
  }
  // Purple Table Headings
220
  .purple {
Jacob Thornton's avatar
Jacob Thornton committed
221
222
223
    color: @purple;
    border-bottom-color: @purple;
  }
224
225
  .headerSortUp.purple,
  .headerSortDown.purple {
Jacob Thornton's avatar
Jacob Thornton committed
226
227
    background-color: lighten(@purple, 40%);
  }
228
}