_tables.scss 2.72 KB
Newer Older
1
//
2
// Basic Bootstrap table
3
//
Jacob Thornton's avatar
Jacob Thornton committed
4

5
.table {
Jacob Thornton's avatar
Jacob Thornton committed
6
  width: 100%;
7
  max-width: 100%;
Mark Otto's avatar
Mark Otto committed
8
9
  margin-bottom: $spacer;

10
11
12
13
  th,
  td {
    padding: $table-cell-padding;
    vertical-align: top;
14
    border-top: $table-border-width solid $table-border-color;
15
  }
16
17

  thead th {
18
    vertical-align: bottom;
19
    border-bottom: (2 * $table-border-width) solid $table-border-color;
20
  }
21
22

  tbody + tbody {
23
    border-top: (2 * $table-border-width) solid $table-border-color;
24
  }
Mark Otto's avatar
Mark Otto committed
25

26
27
28
  .table {
    background-color: $body-bg;
  }
29
30
}

31

32
//
33
// Condensed table w/ half padding
34
//
35

36
.table-sm {
37
38
39
  th,
  td {
    padding: $table-sm-cell-padding;
40
  }
41
42
43
}


44
// Bordered version
45
46
//
// Add borders all around the table and between all the columns.
47

48
.table-bordered {
49
  border: $table-border-width solid $table-border-color;
50
51
52

  th,
  td {
53
    border: $table-border-width solid $table-border-color;
54
  }
55
56
57
58

  thead {
    th,
    td {
59
      border-bottom-width: (2 * $table-border-width);
60
61
    }
  }
Jacob Thornton's avatar
Jacob Thornton committed
62
63
}

64

65
// Zebra-striping
66
//
67
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
68

69
.table-striped {
Mark Otto's avatar
Mark Otto committed
70
  tbody tr:nth-of-type(odd) {
Mark Otto's avatar
Mark Otto committed
71
    background-color: $table-bg-accent;
72
73
74
75
  }
}


76
// Hover effect
77
//
78
// Placed here since it has to come after the potential zebra striping
79

80
.table-hover {
81
82
83
84
  tbody tr {
    @include hover {
      background-color: $table-bg-hover;
    }
85
86
87
  }
}

88

89
// Table backgrounds
90
//
91
92
// Exact selectors below required to override `.table-striped` and prevent
// inheritance to nested tables.
93

94
// Generate the contextual variants
Mark Otto's avatar
Mark Otto committed
95
96
97
98
99
@include table-row-variant(active, $table-bg-active);
@include table-row-variant(success, $state-success-bg);
@include table-row-variant(info, $state-info-bg);
@include table-row-variant(warning, $state-warning-bg);
@include table-row-variant(danger, $state-danger-bg);
100
101


102
// Inverse styles
103
//
104
// Same table markup, but inverted color scheme: dark background and light text.
Mark Otto's avatar
Mark Otto committed
105

106
107
.thead-inverse {
  th {
108
109
    color: $table-inverse-color;
    background-color: $table-inverse-bg;
Mark Otto's avatar
Mark Otto committed
110
111
  }
}
112

113
114
.thead-default {
  th {
115
116
    color: $table-head-color;
    background-color: $table-head-bg;
Mark Otto's avatar
Mark Otto committed
117
118
119
  }
}

Mark Otto's avatar
Mark Otto committed
120
.table-inverse {
121
122
  color: $table-inverse-color;
  background-color: $table-inverse-bg;
Mark Otto's avatar
Mark Otto committed
123

124
  th,
Mark Otto's avatar
Mark Otto committed
125
126
  td,
  thead th {
127
    border-color: $body-bg;
Mark Otto's avatar
Mark Otto committed
128
  }
129
130
131
132
133
134
135
136
137
138

  &.table-bordered {
    border: 0;
  }
}



// Responsive tables
//
Mark Otto's avatar
Mark Otto committed
139
140
// Add `.table-responsive` to `.table`s and we'll make them mobile friendly by
// enabling horizontal scrolling. Only applies <768px. Everything above that
141
142
143
144
145
146
// will display normally.

.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
147
  -ms-overflow-style: -ms-autohiding-scrollbar; // See https://github.com/twbs/bootstrap/pull/10057
148
149
150
151
152

  // Prevent double border on horizontal scroll due to use of `display: block;`
  &.table-bordered {
    border: 0;
  }
Mark Otto's avatar
Mark Otto committed
153
}