tables.less.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. //
  2. // Tables.less
  3. // Tables for, you guessed it, tabular data
  4. // ----------------------------------------
  5. // BASE TABLES
  6. // -----------------
  7. table {
  8. max-width: 100%;
  9. background-color: @tableBackground;
  10. border-collapse: collapse;
  11. border-spacing: 0;
  12. }
  13. // BASELINE STYLES
  14. // ---------------
  15. .table {
  16. width: 100%;
  17. margin-bottom: @baseLineHeight;
  18. // Cells
  19. th,
  20. td {
  21. padding: 8px;
  22. line-height: @baseLineHeight;
  23. text-align: left;
  24. vertical-align: top;
  25. border-top: 1px solid @tableBorder;
  26. }
  27. th {
  28. font-weight: bold;
  29. }
  30. // Bottom align for column headings
  31. thead th {
  32. vertical-align: bottom;
  33. }
  34. // Remove top border from thead by default
  35. caption + thead tr:first-child th,
  36. caption + thead tr:first-child td,
  37. colgroup + thead tr:first-child th,
  38. colgroup + thead tr:first-child td,
  39. thead:first-child tr:first-child th,
  40. thead:first-child tr:first-child td {
  41. border-top: 0;
  42. }
  43. // Account for multiple tbody instances
  44. tbody + tbody {
  45. border-top: 2px solid @tableBorder;
  46. }
  47. }
  48. // CONDENSED TABLE W/ HALF PADDING
  49. // -------------------------------
  50. .table-condensed {
  51. th,
  52. td {
  53. padding: 4px 5px;
  54. }
  55. }
  56. // BORDERED VERSION
  57. // ----------------
  58. .table-bordered {
  59. border: 1px solid @tableBorder;
  60. border-collapse: separate; // Done so we can round those corners!
  61. *border-collapse: collapsed; // IE7 can't round corners anyway
  62. border-left: 0;
  63. .border-radius(4px);
  64. th,
  65. td {
  66. border-left: 1px solid @tableBorder;
  67. }
  68. // Prevent a double border
  69. caption + thead tr:first-child th,
  70. caption + tbody tr:first-child th,
  71. caption + tbody tr:first-child td,
  72. colgroup + thead tr:first-child th,
  73. colgroup + tbody tr:first-child th,
  74. colgroup + tbody tr:first-child td,
  75. thead:first-child tr:first-child th,
  76. tbody:first-child tr:first-child th,
  77. tbody:first-child tr:first-child td {
  78. border-top: 0;
  79. }
  80. // For first th or td in the first row in the first thead or tbody
  81. thead:first-child tr:first-child th:first-child,
  82. tbody:first-child tr:first-child td:first-child {
  83. -webkit-border-top-left-radius: 4px;
  84. border-top-left-radius: 4px;
  85. -moz-border-radius-topleft: 4px;
  86. }
  87. thead:first-child tr:first-child th:last-child,
  88. tbody:first-child tr:first-child td:last-child {
  89. -webkit-border-top-right-radius: 4px;
  90. border-top-right-radius: 4px;
  91. -moz-border-radius-topright: 4px;
  92. }
  93. // For first th or td in the first row in the first thead or tbody
  94. thead:last-child tr:last-child th:first-child,
  95. tbody:last-child tr:last-child td:first-child {
  96. .border-radius(0 0 0 4px);
  97. -webkit-border-bottom-left-radius: 4px;
  98. border-bottom-left-radius: 4px;
  99. -moz-border-radius-bottomleft: 4px;
  100. }
  101. thead:last-child tr:last-child th:last-child,
  102. tbody:last-child tr:last-child td:last-child {
  103. -webkit-border-bottom-right-radius: 4px;
  104. border-bottom-right-radius: 4px;
  105. -moz-border-radius-bottomright: 4px;
  106. }
  107. }
  108. // ZEBRA-STRIPING
  109. // --------------
  110. // Default zebra-stripe styles (alternating gray and transparent backgrounds)
  111. .table-striped {
  112. tbody {
  113. tr:nth-child(odd) td,
  114. tr:nth-child(odd) th {
  115. background-color: @tableBackgroundAccent;
  116. }
  117. }
  118. }
  119. // HOVER EFFECT
  120. // ------------
  121. // Placed here since it has to come after the potential zebra striping
  122. .table {
  123. tbody tr:hover td,
  124. tbody tr:hover th {
  125. background-color: @tableBackgroundHover;
  126. }
  127. }
  128. // TABLE CELL SIZING
  129. // -----------------
  130. // Change the columns
  131. table {
  132. .span1 { .tableColumns(1); }
  133. .span2 { .tableColumns(2); }
  134. .span3 { .tableColumns(3); }
  135. .span4 { .tableColumns(4); }
  136. .span5 { .tableColumns(5); }
  137. .span6 { .tableColumns(6); }
  138. .span7 { .tableColumns(7); }
  139. .span8 { .tableColumns(8); }
  140. .span9 { .tableColumns(9); }
  141. .span10 { .tableColumns(10); }
  142. .span11 { .tableColumns(11); }
  143. .span12 { .tableColumns(12); }
  144. .span13 { .tableColumns(13); }
  145. .span14 { .tableColumns(14); }
  146. .span15 { .tableColumns(15); }
  147. .span16 { .tableColumns(16); }
  148. .span17 { .tableColumns(17); }
  149. .span18 { .tableColumns(18); }
  150. .span19 { .tableColumns(19); }
  151. .span20 { .tableColumns(20); }
  152. .span21 { .tableColumns(21); }
  153. .span22 { .tableColumns(22); }
  154. .span23 { .tableColumns(23); }
  155. .span24 { .tableColumns(24); }
  156. }