tables.less 4.8 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
}
th,
td {
  padding: 8px;
  line-height: @baseLineHeight;
  text-align: left;
20
  border-top: 1px solid #ddd;
21
22
23
24
25
26
27
28
}
th {
  font-weight: bold;
  vertical-align: bottom;
}
td {
  vertical-align: top;
}
29
30


31
32
// CONDENSED TABLE W/ HALF PADDING
// -------------------------------
33
34
35
36

.condensed-table {
  th,
  td {
37
    padding: 4px 5px;
38
  }
39
40
41
42
43
44
45
46
47
48
}


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

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

75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// 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;
    }
  }
}



/*
92
93
94
95
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
// ----------------

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