panels.less 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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: @panel-body-padding;
  15. &:extend(.clearfix all);
  16. }
  17. // Optional heading
  18. .panel-heading {
  19. padding: @panel-heading-padding;
  20. border-bottom: 1px solid transparent;
  21. .border-top-radius((@panel-border-radius - 1));
  22. > .dropdown .dropdown-toggle {
  23. color: inherit;
  24. }
  25. }
  26. // Within heading, strip any `h*` tag of its default margins for spacing.
  27. .panel-title {
  28. margin-top: 0;
  29. margin-bottom: 0;
  30. font-size: ceil((@font-size-base * 1.125));
  31. color: inherit;
  32. > a,
  33. > small,
  34. > .small,
  35. > small > a,
  36. > .small > a {
  37. color: inherit;
  38. }
  39. }
  40. // Optional footer (stays gray in every modifier class)
  41. .panel-footer {
  42. padding: @panel-footer-padding;
  43. background-color: @panel-footer-bg;
  44. border-top: 1px solid @panel-inner-border;
  45. .border-bottom-radius((@panel-border-radius - 1));
  46. }
  47. // List groups in panels
  48. //
  49. // By default, space out list group content from panel headings to account for
  50. // any kind of custom content between the two.
  51. .panel {
  52. > .list-group,
  53. > .panel-collapse > .list-group {
  54. margin-bottom: 0;
  55. .list-group-item {
  56. border-width: 1px 0;
  57. border-radius: 0;
  58. }
  59. // Add border top radius for first one
  60. &:first-child {
  61. .list-group-item:first-child {
  62. border-top: 0;
  63. .border-top-radius((@panel-border-radius - 1));
  64. }
  65. }
  66. // Add border bottom radius for last one
  67. &:last-child {
  68. .list-group-item:last-child {
  69. border-bottom: 0;
  70. .border-bottom-radius((@panel-border-radius - 1));
  71. }
  72. }
  73. }
  74. }
  75. // Collapse space between when there's no additional content.
  76. .panel-heading + .list-group {
  77. .list-group-item:first-child {
  78. border-top-width: 0;
  79. }
  80. }
  81. .list-group + .panel-footer {
  82. border-top-width: 0;
  83. }
  84. // Tables in panels
  85. //
  86. // Place a non-bordered `.table` within a panel (not within a `.panel-body`) and
  87. // watch it go full width.
  88. .panel {
  89. > .table,
  90. > .table-responsive > .table,
  91. > .panel-collapse > .table {
  92. margin-bottom: 0;
  93. caption {
  94. padding-left: @panel-body-padding;
  95. padding-right: @panel-body-padding;
  96. }
  97. }
  98. // Add border top radius for first one
  99. > .table:first-child,
  100. > .table-responsive:first-child > .table:first-child {
  101. .border-top-radius((@panel-border-radius - 1));
  102. > thead:first-child,
  103. > tbody:first-child {
  104. > tr:first-child {
  105. border-top-left-radius: (@panel-border-radius - 1);
  106. border-top-right-radius: (@panel-border-radius - 1);
  107. td:first-child,
  108. th:first-child {
  109. border-top-left-radius: (@panel-border-radius - 1);
  110. }
  111. td:last-child,
  112. th:last-child {
  113. border-top-right-radius: (@panel-border-radius - 1);
  114. }
  115. }
  116. }
  117. }
  118. // Add border bottom radius for last one
  119. > .table:last-child,
  120. > .table-responsive:last-child > .table:last-child {
  121. .border-bottom-radius((@panel-border-radius - 1));
  122. > tbody:last-child,
  123. > tfoot:last-child {
  124. > tr:last-child {
  125. border-bottom-left-radius: (@panel-border-radius - 1);
  126. border-bottom-right-radius: (@panel-border-radius - 1);
  127. td:first-child,
  128. th:first-child {
  129. border-bottom-left-radius: (@panel-border-radius - 1);
  130. }
  131. td:last-child,
  132. th:last-child {
  133. border-bottom-right-radius: (@panel-border-radius - 1);
  134. }
  135. }
  136. }
  137. }
  138. > .panel-body + .table,
  139. > .panel-body + .table-responsive,
  140. > .table + .panel-body,
  141. > .table-responsive + .panel-body {
  142. border-top: 1px solid @table-border-color;
  143. }
  144. > .table > tbody:first-child > tr:first-child th,
  145. > .table > tbody:first-child > tr:first-child td {
  146. border-top: 0;
  147. }
  148. > .table-bordered,
  149. > .table-responsive > .table-bordered {
  150. border: 0;
  151. > thead,
  152. > tbody,
  153. > tfoot {
  154. > tr {
  155. > th:first-child,
  156. > td:first-child {
  157. border-left: 0;
  158. }
  159. > th:last-child,
  160. > td:last-child {
  161. border-right: 0;
  162. }
  163. }
  164. }
  165. > thead,
  166. > tbody {
  167. > tr:first-child {
  168. > td,
  169. > th {
  170. border-bottom: 0;
  171. }
  172. }
  173. }
  174. > tbody,
  175. > tfoot {
  176. > tr:last-child {
  177. > td,
  178. > th {
  179. border-bottom: 0;
  180. }
  181. }
  182. }
  183. }
  184. > .table-responsive {
  185. border: 0;
  186. margin-bottom: 0;
  187. }
  188. }
  189. // Collapsable panels (aka, accordion)
  190. //
  191. // Wrap a series of panels in `.panel-group` to turn them into an accordion with
  192. // the help of our collapse JavaScript plugin.
  193. .panel-group {
  194. margin-bottom: @line-height-computed;
  195. // Tighten up margin so it's only between panels
  196. .panel {
  197. margin-bottom: 0;
  198. border-radius: @panel-border-radius;
  199. + .panel {
  200. margin-top: 5px;
  201. }
  202. }
  203. .panel-heading {
  204. border-bottom: 0;
  205. + .panel-collapse > .panel-body,
  206. + .panel-collapse > .list-group {
  207. border-top: 1px solid @panel-inner-border;
  208. }
  209. }
  210. .panel-footer {
  211. border-top: 0;
  212. + .panel-collapse .panel-body {
  213. border-bottom: 1px solid @panel-inner-border;
  214. }
  215. }
  216. }
  217. // Contextual variations
  218. .panel-default {
  219. .panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);
  220. }
  221. .panel-primary {
  222. .panel-variant(@panel-primary-border; @panel-primary-text; @panel-primary-heading-bg; @panel-primary-border);
  223. }
  224. .panel-success {
  225. .panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border);
  226. }
  227. .panel-info {
  228. .panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border);
  229. }
  230. .panel-warning {
  231. .panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border);
  232. }
  233. .panel-danger {
  234. .panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border);
  235. }