panels.less 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. //
  2. // Panels
  3. // --------------------------------------------------
  4. // Base class
  5. .panel {
  6. margin-bottom: @line-height-computed;
  7. background-color: @panel-bg;
  8. border: 1px solid transparent;
  9. border-radius: @panel-border-radius;
  10. .box-shadow(0 1px 1px rgba(0,0,0,.05));
  11. }
  12. // Panel contents
  13. .panel-body {
  14. padding: 15px;
  15. .clearfix();
  16. }
  17. // List groups in panels
  18. //
  19. // By default, space out list group content from panel headings to account for
  20. // any kind of custom content between the two.
  21. .panel {
  22. > .list-group {
  23. margin-bottom: 0;
  24. .list-group-item {
  25. border-width: 1px 0;
  26. // Remove border radius for top one
  27. &:first-child {
  28. .border-top-radius(0);
  29. }
  30. // But keep it for the last one
  31. &:last-child {
  32. border-bottom: 0;
  33. }
  34. }
  35. }
  36. }
  37. // Collapse space between when there's no additional content.
  38. .panel-heading + .list-group {
  39. .list-group-item:first-child {
  40. border-top-width: 0;
  41. }
  42. }
  43. // Tables in panels
  44. //
  45. // Place a non-bordered `.table` within a panel (not within a `.panel-body`) and
  46. // watch it go full width.
  47. .panel {
  48. > .table,
  49. > .table-responsive > .table {
  50. margin-bottom: 0;
  51. }
  52. > .panel-body + .table,
  53. > .panel-body + .table-responsive {
  54. border-top: 1px solid @table-border-color;
  55. }
  56. > .table > tbody:first-child th,
  57. > .table > tbody:first-child td {
  58. border-top: 0;
  59. }
  60. > .table-bordered,
  61. > .table-responsive > .table-bordered {
  62. border: 0;
  63. > thead,
  64. > tbody,
  65. > tfoot {
  66. > tr {
  67. > th:first-child,
  68. > td:first-child {
  69. border-left: 0;
  70. }
  71. > th:last-child,
  72. > td:last-child {
  73. border-right: 0;
  74. }
  75. &:last-child > th,
  76. &:last-child > td {
  77. border-bottom: 0;
  78. }
  79. }
  80. }
  81. }
  82. > .table-responsive {
  83. border: 0;
  84. margin-bottom: 0;
  85. }
  86. }
  87. // Optional heading
  88. .panel-heading {
  89. padding: 10px 15px;
  90. border-bottom: 1px solid transparent;
  91. .border-top-radius(@panel-border-radius - 1);
  92. > .dropdown .dropdown-toggle {
  93. color: inherit;
  94. }
  95. }
  96. // Within heading, strip any `h*` tag of it's default margins for spacing.
  97. .panel-title {
  98. margin-top: 0;
  99. margin-bottom: 0;
  100. font-size: ceil((@font-size-base * 1.125));
  101. color: inherit;
  102. > a {
  103. color: inherit;
  104. }
  105. }
  106. // Optional footer (stays gray in every modifier class)
  107. .panel-footer {
  108. padding: 10px 15px;
  109. background-color: @panel-footer-bg;
  110. border-top: 1px solid @panel-inner-border;
  111. .border-bottom-radius(@panel-border-radius - 1);
  112. }
  113. // Collapsable panels (aka, accordion)
  114. //
  115. // Wrap a series of panels in `.panel-group` to turn them into an accordion with
  116. // the help of our collapse JavaScript plugin.
  117. .panel-group {
  118. // Tighten up margin so it's only between panels
  119. .panel {
  120. margin-bottom: 0;
  121. border-radius: @panel-border-radius;
  122. overflow: hidden; // crop contents when collapsed
  123. + .panel {
  124. margin-top: 5px;
  125. }
  126. }
  127. .panel-heading {
  128. border-bottom: 0;
  129. + .panel-collapse .panel-body {
  130. border-top: 1px solid @panel-inner-border;
  131. }
  132. }
  133. .panel-footer {
  134. border-top: 0;
  135. + .panel-collapse .panel-body {
  136. border-bottom: 1px solid @panel-inner-border;
  137. }
  138. }
  139. }
  140. // Contextual variations
  141. .panel-default {
  142. .panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);
  143. }
  144. .panel-primary {
  145. .panel-variant(@panel-primary-border; @panel-primary-text; @panel-primary-heading-bg; @panel-primary-border);
  146. }
  147. .panel-success {
  148. .panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border);
  149. }
  150. .panel-warning {
  151. .panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border);
  152. }
  153. .panel-danger {
  154. .panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border);
  155. }
  156. .panel-info {
  157. .panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border);
  158. }