panels.less 5.47 KB
Newer Older
1
2
3
4
5
6
7
//
// Panels
// --------------------------------------------------


// Base class
.panel {
Mark Otto's avatar
Mark Otto committed
8
  margin-bottom: @line-height-computed;
9
  background-color: @panel-bg;
10
  border: 1px solid transparent;
11
  border-radius: @panel-border-radius;
12
  box-shadow: 0 1px 1px rgba(0,0,0,.05);
13
14
}

Mark Otto's avatar
Mark Otto committed
15
16
// Panel contents
.panel-body {
17
  padding: @panel-body-padding;
18
  &:extend(.clearfix all);
Mark Otto's avatar
Mark Otto committed
19
20
}

21
22
// Optional heading
.panel-heading {
23
  padding: @panel-heading-padding;
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  border-bottom: 1px solid transparent;
  .border-top-radius((@panel-border-radius - 1));

  > .dropdown .dropdown-toggle {
    color: inherit;
  }
}

// Within heading, strip any `h*` tag of its default margins for spacing.
.panel-title {
  margin-top: 0;
  margin-bottom: 0;
  font-size: ceil((@font-size-base * 1.125));
  color: inherit;

  > a {
    color: inherit;
  }
}

// Optional footer (stays gray in every modifier class)
.panel-footer {
46
  padding: @panel-footer-padding;
47
48
49
50
51
  background-color: @panel-footer-bg;
  border-top: 1px solid @panel-inner-border;
  .border-bottom-radius((@panel-border-radius - 1));
}

52

53
54
55
56
// List groups in panels
//
// By default, space out list group content from panel headings to account for
// any kind of custom content between the two.
57

58
.panel {
59
  > .list-group {
Mark Otto's avatar
Mark Otto committed
60
    margin-bottom: 0;
61

62
63
    .list-group-item {
      border-width: 1px 0;
64
      border-radius: 0;
65
    }
66

67
68
69
    // Add border top radius for first one
    &:first-child {
      .list-group-item:first-child {
70
        border-top: 0;
71
72
73
74
75
76
        .border-top-radius((@panel-border-radius - 1));
      }
    }
    // Add border bottom radius for last one
    &:last-child {
      .list-group-item:last-child {
77
        border-bottom: 0;
78
79
80
        .border-bottom-radius((@panel-border-radius - 1));
      }
    }
81
  }
82
}
83
84
85
86
87
88
// Collapse space between when there's no additional content.
.panel-heading + .list-group {
  .list-group-item:first-child {
    border-top-width: 0;
  }
}
Ben Zumhagen's avatar
Ben Zumhagen committed
89
90
91
.list-group + .panel-footer {
  border-top-width: 0;
}
92
93
94
95
96
97
98

// Tables in panels
//
// Place a non-bordered `.table` within a panel (not within a `.panel-body`) and
// watch it go full width.

.panel {
99
  > .table,
Mark Otto's avatar
Mark Otto committed
100
101
  > .table-responsive > .table,
  > .panel-collapse > .table {
102
    margin-bottom: 0;
103
104
105
106
  }
  // Add border top radius for first one
  > .table:first-child,
  > .table-responsive:first-child > .table:first-child {
107
    .border-top-radius((@panel-border-radius - 1));
108

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
    > thead:first-child,
    > tbody:first-child {
      > tr:first-child {
        td:first-child,
        th:first-child {
          border-top-left-radius: (@panel-border-radius - 1);
        }
        td:last-child,
        th:last-child {
          border-top-right-radius: (@panel-border-radius - 1);
        }
      }
    }
  }
  // Add border bottom radius for last one
  > .table:last-child,
  > .table-responsive:last-child > .table:last-child {
126
    .border-bottom-radius((@panel-border-radius - 1));
127

Supergibbs's avatar
Supergibbs committed
128
129
130
131
132
133
134
135
136
137
138
139
140
    > tbody:last-child,
    > tfoot:last-child {
      > tr:last-child {
        td:first-child,
        th:first-child {
          border-bottom-left-radius: (@panel-border-radius - 1);
        }
        td:last-child,
        th:last-child {
          border-bottom-right-radius: (@panel-border-radius - 1);
        }
      }
    }
141
  }
142
143
  > .panel-body + .table,
  > .panel-body + .table-responsive {
144
145
    border-top: 1px solid @table-border-color;
  }
146
147
  > .table > tbody:first-child > tr:first-child th,
  > .table > tbody:first-child > tr:first-child td {
148
149
    border-top: 0;
  }
150
151
  > .table-bordered,
  > .table-responsive > .table-bordered {
152
    border: 0;
153
154
155
156
157
158
    > thead,
    > tbody,
    > tfoot {
      > tr {
        > th:first-child,
        > td:first-child {
159
          border-left: 0;
160
161
162
        }
        > th:last-child,
        > td:last-child {
163
164
          border-right: 0;
        }
165
166
167
168
169
170
171
172
      }
    }
    > thead,
    > tbody {
      > tr:first-child {
        > td,
        > th {
          border-bottom: 0;
173
        }
174
175
176
177
178
179
180
      }
    }
    > tbody,
    > tfoot {
      > tr:last-child {
        > td,
        > th {
181
          border-bottom: 0;
182
183
184
185
        }
      }
    }
  }
186
187
188
189
  > .table-responsive {
    border: 0;
    margin-bottom: 0;
  }
190
191
192
}


Mark Otto's avatar
Mark Otto committed
193
194
195
196
197
198
// Collapsable panels (aka, accordion)
//
// Wrap a series of panels in `.panel-group` to turn them into an accordion with
// the help of our collapse JavaScript plugin.

.panel-group {
199
200
  margin-bottom: @line-height-computed;

Mark Otto's avatar
Mark Otto committed
201
202
203
204
205
206
207
208
209
210
211
  // Tighten up margin so it's only between panels
  .panel {
    margin-bottom: 0;
    border-radius: @panel-border-radius;
    + .panel {
      margin-top: 5px;
    }
  }

  .panel-heading {
    border-bottom: 0;
212
    + .panel-collapse > .panel-body {
213
      border-top: 1px solid @panel-inner-border;
Mark Otto's avatar
Mark Otto committed
214
215
216
217
218
    }
  }
  .panel-footer {
    border-top: 0;
    + .panel-collapse .panel-body {
219
      border-bottom: 1px solid @panel-inner-border;
Mark Otto's avatar
Mark Otto committed
220
221
222
223
224
    }
  }
}


225
// Contextual variations
226
227
228
.panel-default {
  .panel-variant(@panel-default-border; @panel-default-text; @panel-default-heading-bg; @panel-default-border);
}
Mark Otto's avatar
Mark Otto committed
229
.panel-primary {
230
  .panel-variant(@panel-primary-border; @panel-primary-text; @panel-primary-heading-bg; @panel-primary-border);
Mark Otto's avatar
Mark Otto committed
231
}
232
.panel-success {
233
  .panel-variant(@panel-success-border; @panel-success-text; @panel-success-heading-bg; @panel-success-border);
234
}
235
236
237
.panel-info {
  .panel-variant(@panel-info-border; @panel-info-text; @panel-info-heading-bg; @panel-info-border);
}
238
.panel-warning {
239
  .panel-variant(@panel-warning-border; @panel-warning-text; @panel-warning-heading-bg; @panel-warning-border);
240
241
}
.panel-danger {
242
  .panel-variant(@panel-danger-border; @panel-danger-text; @panel-danger-heading-bg; @panel-danger-border);
243
}