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

6

7

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

table {
  width: 100%;
13
  margin-bottom: @baseLineHeight;
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
}
th,
td {
  padding: 8px;
  line-height: @baseLineHeight;
  text-align: left;
  border-bottom: 1px solid #ddd;
}
th {
  font-weight: bold;
  vertical-align: bottom;
}
td {
  vertical-align: top;
}
tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
32
33
34
}


35
36
// CONDENSED TABLE W/ HALF PADDING
// -------------------------------
37
38
39
40

.condensed-table {
  th,
  td {
41
    padding: 4px 5px;
42
  }
43
44
45
46
47
48
49
50
51
52
}


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

.bordered-table {
  border: 1px solid #ddd;
  border-collapse: separate; // Done so we can round those corners!
  .border-radius(4px);
53
  th + th,
54
  td + td,
55
56
  th + td,
  td + th {
57
58
    border-left: 1px solid #ddd;
  }
59
  // For first th or td in the first row in the first thead or tbody
60
61
  thead:first-child tr:first-child th:first-child,
  tbody:first-child tr:first-child td:first-child {
62
63
    .border-radius(4px 0 0 0);
  }
64
65
  thead:first-child tr:first-child th:last-child,
  tbody:first-child tr:first-child td:last-child {
66
67
    .border-radius(0 4px 0 0);
  }
68
69
70
  // 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 {
71
72
    .border-radius(0 0 0 4px);
  }
73
74
  thead:last-child tr:last-child th:last-child,
  tbody:last-child tr:last-child td:last-child {
75
76
    .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
// 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;
    }
  }
}



/*
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// ----------------

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