1
+ /* *
2
+ * @stylesheet styles.less Styles
3
+ * @parent bit-docs/theme
4
+ *
5
+ * @description Styles for the generated site.
6
+ */
7
+
1
8
@import " locate://bit-docs-site/styles/variables.less" ;
2
9
3
- .flex-mixin {
4
- display : -webkit-box ;
5
- display : -moz-box ;
6
- display : -ms-flexbox ;
7
- display : -webkit-flex ;
8
- display : flex ;
9
- }
10
+ /*
11
+ Mobile:
12
+ ┌─────────────────────────────────┐
13
+ │ html ▶ box-sizing: border-box ├ Everything border-box.
14
+ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
15
+ │ ┃ body ▶ margin: auto ┣━━ Kill default margins.
16
+ │ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ │
17
+ │ ┃ ┃ header ┃ ┃ │
18
+ │ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ │
19
+ │ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ │
20
+ │ ┃ ┃ .content ┃ ┃ │
21
+ │ ┃ ┃ ┏━━━━━━━━━━━━━━━━━━━━━┓ ┃ ┃ │
22
+ │ ┃ ┃ ┃ .sidebar ┃ ┃ ┃ │
23
+ │ ┃ ┃ ┃ ┏━━━━━━━━━━━━━━━━━┓ ┃ ┃ ┃ │
24
+ │ ┃ ┃ ┃ ┃ ul ▶ padding: 0 ┣━━━━━━━━ Make flush with parent.
25
+ │ ┃ ┃ ┃ ┗━━━━━━━━━━━━━━━━━┛ ┃ ┃ ┃ │
26
+ │ ┃ ┃ ┗━━━━━━━━━━━━━━━━━━━━━┛ ┃ ┃ │
27
+ │ ┃ ┃ ┏━━━━━━━━━━━━━━━━━━━━━┓ ┃ ┃ │
28
+ │ ┃ ┃ ┃ .main ┃ ┃ ┃ │
29
+ │ ┃ ┃ ┗━━━━━━━━━━━━━━━━━━━━━┛ ┃ ┃ │
30
+ │ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ │
31
+ │ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ │
32
+ │ ┃ ┃ footer ┃ ┃ │
33
+ │ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ │
34
+ │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ │
35
+ └─────────────────────────────────┘
36
+ */
10
37
38
+ // Everything inherits border-box sizing
39
+ // https://css-tricks.com/box-sizing
11
40
html {
12
- height : 100% ;
13
41
box-sizing : border-box ;
14
- }
15
42
16
- * , * :before , * :after {
17
- box-sizing : inherit ; // https://css-tricks.com/box-sizing/
43
+ * , * :before , * :after {
44
+ box-sizing : inherit ;
45
+ }
18
46
}
19
47
20
48
body {
21
- .flex-mixin ;
22
- width : 100% ;
23
- height : 100vh ;
24
49
margin : auto ;
25
- flex-direction : column ;
26
- justify-content : space-between ;
27
50
font-family : @defaultFontFamily ;
28
51
}
29
52
30
- header , footer {
31
- width : 100% ;
32
- flex-shrink : 0 ; // retain height
53
+ // Consistent content padding
54
+ header , footer , .sidebar , .main {
55
+ padding-left : 25px ;
56
+ padding-right : 25px ;
33
57
}
34
58
35
59
.content {
36
- flex-grow : 1 ; // fill space vertical
37
- flex-shrink : 1 ; // IE10 sets flex-shrink to 0
60
+ // Navigation list flush with parent
61
+ .sidebar {
62
+ ul {
63
+ padding : 0 ;
64
+ }
38
65
39
- @media @desktops {
40
- .flex-mixin ;
41
- overflow : auto ; // scroll .content when .main overflows
42
- }
66
+ li {
67
+ list-style-type : none ;
43
68
44
- .sidebar {
45
- overflow : auto ; // scroll .sidebar when <ul> overflows
46
- flex-shrink : 0 ; // retain width
69
+ li {
70
+ padding-left : 25 px ;
71
+ }
47
72
48
- .current > a {
49
- font-weight : bold ;
73
+ .current > a {
74
+ font-weight : bold ;
75
+ }
50
76
}
51
77
}
52
78
53
79
.main {
54
- flex-grow : 1 ; // fill space horizontal
55
- flex-shrink : 1 ;
56
- padding-left : 25px ;
57
- padding-right : 25px ;
58
80
overflow-x : hidden ; // hide <pre> code overflow
59
81
}
60
- }
82
+ }
83
+
84
+ /*
85
+ Desktop:
86
+ ┌──────────────────────────────────────────────────────┐
87
+ │ html ▶ height: 100% ├ Get window height.
88
+ │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ │
89
+ │ ┃ body ▶ height: 100%, ┣━━ Use html/window height.
90
+ │ ┃ flex-direction: column ┣━━ Children are in column.
91
+ │ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ │
92
+ │ ┃ ┃ header ▶ flex: none ┣━━━━ Use content height.
93
+ │ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ │
94
+ │ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ │
95
+ │ ┃ ┃ .content ▶ flex: auto, ┣━━━━ Fill remaining height.
96
+ │ ┃ ┃ flex-direction: row ┃ ┃ │ Children are in a row.
97
+ │ ┃ ┃ ┏━━━━━━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━┓ ┃ ┃ │
98
+ │ ┃ ┃ ┃ .sidebar ▼ ┃ ┃ .main ▼ ┃ ┃ ┃ │
99
+ │ ┃ ┃ ┃ flex: none, ┃ ┃ flex: auto ┃ ┃ ┃ │
100
+ │ ┃ ┃ ┃ overflow-y: auto ┃ ┃ overflow-y: auto ┃ ┃ ┃ │
101
+ │ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ │
102
+ │ ┃ ┃ ┣ Use content width. ┃ ┣ Fill width. ┃ ┃ ┃ │
103
+ │ ┃ ┃ ┣ Fill height. ┃ ┣ Fill height. ┃ ┃ ┃ │
104
+ │ ┃ ┃ ┣ Scroll vertical. ┃ ┣ Scroll vertical. ┃ ┃ ┃ │
105
+ │ ┃ ┃ ┗━━━━━━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━┛ ┃ ┃ │
106
+ │ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ │
107
+ │ ┃ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ │
108
+ │ ┃ ┃ footer ▶ flex: none ┣━━━━ Use content height.
109
+ │ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ │
110
+ │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ │
111
+ └──────────────────────────────────────────────────────┘
112
+ */
113
+
114
+ // Flexbox bugs: https://github.com/philipwalton/flexbugs
115
+
116
+ .flex {
117
+ display : -webkit-box ;
118
+ display : -webkit-flex ;
119
+ display : -moz-box ;
120
+ display : -ms-flexbox ;
121
+ display : flex ;
122
+ }
123
+
124
+ .flex-row {
125
+ .flex ;
126
+ -webkit-box-orient : horizontal ;
127
+ -webkit-box-direction : normal ;
128
+ -webkit-flex-direction : row ;
129
+ -moz-box-orient : horizontal ;
130
+ -moz-box-direction : normal ;
131
+ -ms-flex-direction : row ;
132
+ flex-direction : row ;
133
+ }
134
+
135
+ .flex-column {
136
+ .flex ;
137
+ -webkit-box-orient : vertical ;
138
+ -webkit-box-direction : normal ;
139
+ -webkit-flex-direction : column ;
140
+ -moz-box-orient : vertical ;
141
+ -moz-box-direction : normal ;
142
+ -ms-flex-direction : column ;
143
+ flex-direction : column ;
144
+ }
145
+
146
+ // flex: 0 1 auto;
147
+ .flex-initial {
148
+ -webkit-box-flex : 0 ;
149
+ -webkit-flex : 0 1 auto ;
150
+ -moz-box-flex : 0 ;
151
+ -ms-flex : 0 1 auto ;
152
+ flex : 0 1 auto ;
153
+ }
154
+
155
+ // flex: 1 1 auto;
156
+ .flex-auto {
157
+ -webkit-box-flex : 1 ;
158
+ -webkit-flex : 1 1 auto ;
159
+ -moz-box-flex : 1 ;
160
+ -ms-flex : 1 1 auto ;
161
+ flex : 1 1 auto ;
162
+ }
163
+
164
+ // flex: 0 0 auto;
165
+ .flex-none {
166
+ -webkit-box-flex : 0 ;
167
+ -webkit-flex : 0 0 auto ;
168
+ -moz-box-flex : 0 ;
169
+ -ms-flex : 0 0 auto ;
170
+ flex : 0 0 auto ;
171
+ }
172
+
173
+ @media @desktops {
174
+ // flex elements fill this space and scroll themselves
175
+ html , body {
176
+ width : 100% ;
177
+ height : 100% ;
178
+ }
179
+
180
+ body {
181
+ .flex-column ; // flex column immediate children
182
+ }
183
+
184
+ header , footer {
185
+ .flex-none ; // use content height
186
+ }
187
+
188
+ .content {
189
+ .flex-auto ; // fill remaining height
190
+
191
+ .flex-row ; // flex row immediate children
192
+
193
+ // Note: Don't add border, padding or margin to a flex-row or flex-column,
194
+ // because IE 10-11 incorrectly assumes content-box sizing for flex-basis.
195
+
196
+ .sidebar {
197
+ .flex-none ; // use content width
198
+ overflow-y : auto ; // scroll vertically
199
+ }
200
+
201
+ .main {
202
+ .flex-auto ; // fill remaining width
203
+ overflow-y : auto ; // scroll vertically
204
+ }
205
+ }
206
+ }
0 commit comments