tables.less 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // stylelint-disable selector-max-type, selector-max-compound-selectors, selector-no-qualifying-type
  2. //
  3. // Tables
  4. // --------------------------------------------------
  5. table {
  6. background-color: @table-bg;
  7. // Table cell sizing
  8. //
  9. // Reset default table behavior
  10. col[class*='col-'] {
  11. position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623)
  12. display: table-column;
  13. float: none;
  14. }
  15. td,
  16. th {
  17. &[class*='col-'] {
  18. position: static; // Prevent border hiding in Firefox and IE9-11 (see https://github.com/twbs/bootstrap/issues/11623)
  19. display: table-cell;
  20. float: none;
  21. }
  22. }
  23. }
  24. caption {
  25. padding-top: @table-cell-padding;
  26. padding-bottom: @table-cell-padding;
  27. color: @text-muted;
  28. text-align: left;
  29. }
  30. th {
  31. text-align: left;
  32. }
  33. // Baseline styles
  34. .table {
  35. width: 100%;
  36. max-width: 100%;
  37. margin-bottom: @line-height-computed;
  38. // Cells
  39. > thead,
  40. > tbody,
  41. > tfoot {
  42. > tr {
  43. > th,
  44. > td {
  45. padding: @table-cell-padding;
  46. line-height: @line-height-base;
  47. vertical-align: top;
  48. border-top: 1px solid @table-border-color;
  49. }
  50. }
  51. }
  52. // Bottom align for column headings
  53. > thead > tr > th {
  54. vertical-align: bottom;
  55. border-bottom: 2px solid @table-border-color;
  56. }
  57. // Remove top border from thead by default
  58. > caption + thead,
  59. > colgroup + thead,
  60. > thead:first-child {
  61. > tr:first-child {
  62. > th,
  63. > td {
  64. border-top: 0;
  65. }
  66. }
  67. }
  68. // Account for multiple tbody instances
  69. > tbody + tbody {
  70. border-top: 2px solid @table-border-color;
  71. }
  72. // Nesting
  73. .table {
  74. background-color: @body-bg;
  75. }
  76. }
  77. // Condensed table w/ half padding
  78. .table-condensed {
  79. > thead,
  80. > tbody,
  81. > tfoot {
  82. > tr {
  83. > th,
  84. > td {
  85. padding: @table-condensed-cell-padding;
  86. }
  87. }
  88. }
  89. }
  90. // Hover effect
  91. //
  92. // Placed here since it has to come after the potential zebra striping
  93. .table-hover {
  94. > tbody > tr:hover {
  95. background-color: @table-bg-hover;
  96. }
  97. }
  98. // Table backgrounds
  99. //
  100. // Exact selectors below required to override `.table-striped` and prevent
  101. // inheritance to nested tables.
  102. // Generate the contextual variants
  103. .table-row-variant(active; @table-bg-active);
  104. .table-row-variant(success; @state-success-bg);
  105. .table-row-variant(info; @state-info-bg);
  106. .table-row-variant(warning; @state-warning-bg);
  107. .table-row-variant(danger; @state-danger-bg);