jekyll-theme-primer 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.md +1 -1
- data/README.md +3 -4
- data/_layouts/default.html +15 -4
- data/_sass/primer-base/LICENSE +1 -1
- data/_sass/primer-base/README.md +6 -6
- data/_sass/primer-base/build/build.css +1 -1
- data/_sass/primer-base/build/index.js +1 -1
- data/_sass/primer-base/lib/base.scss +11 -0
- data/_sass/primer-base/lib/normalize.scss +1 -3
- data/_sass/primer-base/package.json +25 -20
- data/_sass/primer-layout/LICENSE +1 -1
- data/_sass/primer-layout/README.md +12 -12
- data/_sass/primer-layout/docs/grid.md +392 -0
- data/_sass/primer-layout/package.json +27 -21
- data/_sass/primer-markdown/LICENSE +1 -1
- data/_sass/primer-markdown/README.md +6 -6
- data/_sass/primer-markdown/build/build.css +1 -1
- data/_sass/primer-markdown/build/index.js +1 -1
- data/_sass/primer-markdown/lib/code.scss +3 -16
- data/_sass/primer-markdown/lib/lists.scss +5 -1
- data/_sass/primer-markdown/lib/markdown-body.scss +1 -1
- data/_sass/primer-markdown/package.json +23 -18
- data/_sass/primer-support/LICENSE +1 -1
- data/_sass/primer-support/README.md +20 -6
- data/_sass/primer-support/docs/breakpoints.md +60 -0
- data/_sass/primer-support/docs/color-system.md +392 -0
- data/_sass/primer-support/docs/spacing.md +40 -0
- data/_sass/primer-support/docs/typography.md +90 -0
- data/_sass/primer-support/lib/mixins/buttons.scss +13 -9
- data/_sass/primer-support/lib/variables/layout.scss +8 -0
- data/_sass/primer-support/lib/variables/misc.scss +1 -1
- data/_sass/primer-support/package.json +25 -18
- data/_sass/primer-utilities/LICENSE +1 -1
- data/_sass/primer-utilities/README.md +6 -6
- data/_sass/primer-utilities/build/build.css +1 -1
- data/_sass/primer-utilities/build/index.js +1 -1
- data/_sass/primer-utilities/docs/animations.md +75 -0
- data/_sass/primer-utilities/docs/borders.md +127 -0
- data/_sass/primer-utilities/docs/box-shadow.md +107 -0
- data/_sass/primer-utilities/docs/colors.md +232 -0
- data/_sass/primer-utilities/docs/flexbox.md +665 -0
- data/_sass/primer-utilities/docs/layout.md +300 -0
- data/_sass/primer-utilities/docs/margin.md +126 -0
- data/_sass/primer-utilities/docs/padding.md +110 -0
- data/_sass/primer-utilities/docs/typography.md +138 -0
- data/_sass/primer-utilities/lib/animations.scss +32 -2
- data/_sass/primer-utilities/lib/borders.scss +2 -0
- data/_sass/primer-utilities/lib/layout.scss +7 -3
- data/_sass/primer-utilities/package.json +27 -21
- metadata +54 -42
- data/assets/javascript/anchor-js/.eslintrc +0 -77
- data/assets/javascript/anchor-js/.gitattributes +0 -2
- data/assets/javascript/anchor-js/.npmignore +0 -4
- data/assets/javascript/anchor-js/.travis.yml +0 -6
- data/assets/javascript/anchor-js/anchor.js +0 -334
- data/assets/javascript/anchor-js/anchor.min.js +0 -6
- data/assets/javascript/anchor-js/banner.js +0 -17
- data/assets/javascript/anchor-js/docs/anchor.js +0 -334
- data/assets/javascript/anchor-js/docs/favicon.ico +0 -0
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.eot +0 -0
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.svg +0 -11
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.ttf +0 -0
- data/assets/javascript/anchor-js/docs/fonts/anchorjs-extras.woff +0 -0
- data/assets/javascript/anchor-js/docs/fonts/fonts.css +0 -24
- data/assets/javascript/anchor-js/docs/grunticon/grunticon.loader.js +0 -3
- data/assets/javascript/anchor-js/docs/grunticon/icons.data.png.css +0 -5
- data/assets/javascript/anchor-js/docs/grunticon/icons.data.svg.css +0 -5
- data/assets/javascript/anchor-js/docs/grunticon/icons.fallback.css +0 -5
- data/assets/javascript/anchor-js/docs/grunticon/png/grunticon-link.png +0 -0
- data/assets/javascript/anchor-js/docs/img/anchoring-links.png +0 -0
- data/assets/javascript/anchor-js/docs/img/anchorjs_logo.png +0 -0
- data/assets/javascript/anchor-js/docs/img/anchorlinks2.png +0 -0
- data/assets/javascript/anchor-js/docs/img/gh-link.svg +0 -9
- data/assets/javascript/anchor-js/docs/img/gh_link.svg +0 -9
- data/assets/javascript/anchor-js/docs/img/hyperlink.svg +0 -9
- data/assets/javascript/anchor-js/docs/img/link.svg +0 -6
- data/assets/javascript/anchor-js/docs/img/mini-logo.png +0 -0
- data/assets/javascript/anchor-js/docs/img/primer-md.png +0 -0
- data/assets/javascript/anchor-js/docs/scripts.js +0 -12
- data/assets/javascript/anchor-js/docs/styles.css +0 -493
@@ -0,0 +1,107 @@
|
|
1
|
+
---
|
2
|
+
title: Box shadow
|
3
|
+
status: New release
|
4
|
+
status_issue: https://github.com/github/design-systems/issues/269
|
5
|
+
---
|
6
|
+
|
7
|
+
Box shadows are used to make content appear elevated. They are typically applied to containers of content that users need to pay attention to or content that appears on top of (overlapping) other elements on the page (like a pop-over or modal).
|
8
|
+
|
9
|
+
{:toc}
|
10
|
+
|
11
|
+
## Default
|
12
|
+
|
13
|
+
Default shadows are mainly used on things that need to appear slightly elevated, like pricing cards or UI elements containing important information.
|
14
|
+
|
15
|
+
```html
|
16
|
+
<div class="box-shadow p-3">
|
17
|
+
.box-shadow
|
18
|
+
</div>
|
19
|
+
```
|
20
|
+
|
21
|
+
These types of shadows are typically applied to elements with borders, like [`Box`](/styleguide/css/styles/core/components/box).
|
22
|
+
|
23
|
+
```html
|
24
|
+
<div class="col-5">
|
25
|
+
<div class="Box box-shadow">
|
26
|
+
<div class="Box-row">
|
27
|
+
<h3 class="mb-0">Organization</h3>
|
28
|
+
</div>
|
29
|
+
<div class="Box-row">
|
30
|
+
<p class="mb-0 alt-text-small text-gray">
|
31
|
+
Taxidermy live-edge mixtape, keytar tumeric locavore meh selvage deep v letterpress vexillologist lo-fi tousled church-key thundercats. Brooklyn bicycle rights tousled, marfa actually.
|
32
|
+
</p>
|
33
|
+
</div>
|
34
|
+
<div class="Box-row">
|
35
|
+
<button type="button" name="Create an organization" class="btn btn-primary btn-block">Create an organization</button>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
```
|
40
|
+
|
41
|
+
## Medium
|
42
|
+
|
43
|
+
Medium box shadows are more diffused and slightly larger than small box shadows.
|
44
|
+
|
45
|
+
```html
|
46
|
+
<div class="box-shadow-medium p-3">
|
47
|
+
.box-shadow-medium
|
48
|
+
</div>
|
49
|
+
```
|
50
|
+
|
51
|
+
Medium box shadows are typically used on editorialized content that needs to appear elevated. Most of the time, the elements using this level of shadow will be clickable.
|
52
|
+
|
53
|
+
```html
|
54
|
+
<div class="col-6">
|
55
|
+
<a class="d-block box-shadow-medium px-3 pt-4 pb-6 position-relative rounded-1 overflow-hidden no-underline" href="#">
|
56
|
+
<div class="bg-blue position-absolute top-0 left-0 py-1 width-full"></div>
|
57
|
+
<h3 class="text-gray-dark">Serverless architecture</h3>
|
58
|
+
<p class="alt-text-small text-gray">
|
59
|
+
Build powerful, event-driven, serverless architectures with these open-source libraries and frameworks.
|
60
|
+
</p>
|
61
|
+
<ul class="position-absolute bottom-0 pb-3 text-small text-gray list-style-none ">
|
62
|
+
<li class="d-inline-block mr-1"><%= octicon "repo", :class => "mr-1" %>12 Repositories</li>
|
63
|
+
<li class="d-inline-block"><%= octicon "code", :class => "mr-1" %>5 Languages</li>
|
64
|
+
</ul>
|
65
|
+
</a>
|
66
|
+
</div>
|
67
|
+
```
|
68
|
+
|
69
|
+
## Large
|
70
|
+
|
71
|
+
Large box shadows are very diffused and used sparingly in the product UI.
|
72
|
+
|
73
|
+
```html
|
74
|
+
<div class="box-shadow-large p-3">
|
75
|
+
.box-shadow-large
|
76
|
+
</div>
|
77
|
+
```
|
78
|
+
|
79
|
+
These shadows are used for marketing content, UI screenshots, and content that appears on top of other page elements.
|
80
|
+
|
81
|
+
```html
|
82
|
+
<div class="box-shadow-large rounded-2 overflow-hidden">
|
83
|
+
<img src="<%= image_path "modules/site/org_example_nasa.png" %>" class="img-responsive" alt="NASA is on GitHub">
|
84
|
+
</div>
|
85
|
+
```
|
86
|
+
|
87
|
+
## Extra Large
|
88
|
+
|
89
|
+
Extra large box shadows are even more diffused.
|
90
|
+
|
91
|
+
```html
|
92
|
+
<div class="box-shadow-extra-large p-3">
|
93
|
+
.box-shadow-extra-large
|
94
|
+
</div>
|
95
|
+
```
|
96
|
+
|
97
|
+
These shadows are used for marketing content and content that appears on top of other page elements.
|
98
|
+
|
99
|
+
## Remove a box shadow
|
100
|
+
|
101
|
+
Additionally there is a `box-shadow-none` class that removes `box-shadow`:
|
102
|
+
|
103
|
+
```html
|
104
|
+
<div class="box-shadow-large box-shadow-none p-3">
|
105
|
+
.box-shadow-none
|
106
|
+
</div>
|
107
|
+
```
|
@@ -0,0 +1,232 @@
|
|
1
|
+
---
|
2
|
+
title: Colors
|
3
|
+
status: New release
|
4
|
+
status_issue: https://github.com/github/design-systems/issues/97
|
5
|
+
---
|
6
|
+
|
7
|
+
Use color utilities to apply color to the background of elements, text, and borders.
|
8
|
+
|
9
|
+
* [Background colors](#background-colors)
|
10
|
+
* [Text colors](#text-colors)
|
11
|
+
* [Link colors](#link-colors)
|
12
|
+
* [Border colors](#border-colors)
|
13
|
+
|
14
|
+
## Background colors
|
15
|
+
|
16
|
+
Background colors are most commonly used for filling large blocks of content or areas with a color. When selecting a background color, make sure the foreground color contrast passes a minimum WCAG accessibility rating of [level AA](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). Meeting these standards ensures that content is accessible by everyone, regardless of disability or user device. You can [check your color combination with this demo site](http://jxnblk.com/colorable/demos/text/). For more information, read our [accessibility standards](/styleguide/css/principles/accessibility).
|
17
|
+
|
18
|
+
### Gray
|
19
|
+
|
20
|
+
<div class="container-lg clearfix mb-4">
|
21
|
+
<div class="col-3 float-left pr-4">
|
22
|
+
<div class="h4">.bg-gray</div>
|
23
|
+
<code>#f5f5f5, $bg-gray</code>
|
24
|
+
<div class="mt-2 bg-gray" style="height: 60px;"></div>
|
25
|
+
</div>
|
26
|
+
<div class="col-9 float-left">
|
27
|
+
<div class="container-lg clearfix">
|
28
|
+
<div class="col-6 float-left">
|
29
|
+
<div class="h4">.bg-gray-dark</div>
|
30
|
+
<code>#333, $bg-gray-dark</code>
|
31
|
+
<div class="mt-2 bg-gray-dark border-right-0" style="height: 60px;"></div>
|
32
|
+
</div>
|
33
|
+
<div class="col-6 float-left">
|
34
|
+
<div class="h4">.bg-gray-light</div>
|
35
|
+
<code>#fafafa, $bg-gray-light</code>
|
36
|
+
<div class="mt-2 bg-gray-light" style="height: 60px;"></div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
### Blue
|
43
|
+
|
44
|
+
<div class="container-lg clearfix mb-4">
|
45
|
+
<div class="col-3 float-left pr-4">
|
46
|
+
<div class="h4">.bg-blue</div>
|
47
|
+
<code>#4078c0, $bg-blue</code>
|
48
|
+
<div class="mt-2 bg-blue" style="height: 60px;"></div>
|
49
|
+
</div>
|
50
|
+
<div class="col-9 float-left">
|
51
|
+
<div class="container-lg clearfix">
|
52
|
+
<div class="h4">.bg-blue-light</div>
|
53
|
+
<code>#f2f8fa, $bg-blue-light</code>
|
54
|
+
<div class="mt-2 bg-blue-light" style="height: 60px;"></div>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
### Yellow
|
60
|
+
|
61
|
+
<div class="container-lg clearfix mb-4">
|
62
|
+
<div class="col-3 float-left pr-4">
|
63
|
+
<div class="h4">.bg-yellow</div>
|
64
|
+
<code>#ffd36b, $bg-yellow</code>
|
65
|
+
<div class="mt-2 bg-yellow" style="height: 60px;"></div>
|
66
|
+
</div>
|
67
|
+
<div class="col-9 float-left">
|
68
|
+
<div class="container-lg clearfix">
|
69
|
+
<div class="h4">.bg-yellow-light</div>
|
70
|
+
<code>#fff9ea, $bg-yellow-light</code>
|
71
|
+
<div class="mt-2 bg-yellow-light" style="height: 60px;"></div>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
### Red
|
77
|
+
|
78
|
+
<div class="container-lg clearfix mb-4">
|
79
|
+
<div class="col-3 float-left pr-4">
|
80
|
+
<div class="h4">.bg-red</div>
|
81
|
+
<code>#bd2c00, $bg-red</code>
|
82
|
+
<div class="mt-2 bg-red" style="height: 60px;"></div>
|
83
|
+
</div>
|
84
|
+
<div class="col-9 float-left">
|
85
|
+
<div class="container-lg clearfix">
|
86
|
+
<div class="h4">.bg-red-light</div>
|
87
|
+
<code>#fcdede, $bg-red-light</code>
|
88
|
+
<div class="mt-2 bg-red-light" style="height: 60px;"></div>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
### Green
|
94
|
+
|
95
|
+
<div class="container-lg clearfix mb-4">
|
96
|
+
<div class="col-3 float-left pr-4">
|
97
|
+
<div class="h4">.bg-green</div>
|
98
|
+
<code>#6cc644, $bg-green</code>
|
99
|
+
<div class="mt-2 bg-green" style="height: 60px;"></div>
|
100
|
+
</div>
|
101
|
+
<div class="col-9 float-left">
|
102
|
+
<div class="container-lg clearfix">
|
103
|
+
<div class="h4">.bg-green-light</div>
|
104
|
+
<code>#eaffea, $bg-green-light</code>
|
105
|
+
<div class="mt-2 bg-green-light" style="height: 60px;"></div>
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
### Purple
|
112
|
+
|
113
|
+
<div class="container-lg clearfix mb-4">
|
114
|
+
<div class="col-3 float-left pr-4">
|
115
|
+
<div class="h4">.bg-purple</div>
|
116
|
+
<code>#6e5494, $bg-purple</code>
|
117
|
+
<div class="mt-2 bg-purple" style="height: 60px;"></div>
|
118
|
+
</div>
|
119
|
+
<div class="col-9 float-left">
|
120
|
+
<div class="container-lg clearfix">
|
121
|
+
<div class="h4">.bg-purple-light</div>
|
122
|
+
<code>#f5f0ff, $bg-purple-light</code>
|
123
|
+
<div class="mt-2 bg-purple-light" style="height: 60px;"></div>
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
## Text colors
|
129
|
+
|
130
|
+
Use text color utilities to set text or [octicons](/styleguide/css/styles/core/components/octicons) to a specific color. Color contrast must pass a minimum WCAG accessibility rating of [level AA](https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html). This ensures that viewers who cannot see the full color spectrum are able to read the text. To customize outside of the suggested combinations below, we recommend using this [color contrast testing tool](http://jxnblk.com/colorable/demos/text/). For more information, read our [accessibility standards](/styleguide/css/principles/accessibility).
|
131
|
+
|
132
|
+
These are our most common text with background color combinations. They don't all pass accessibility standards currently, but will be updated in the future. **Any of the combinations with a warning icon must be used with caution**.
|
133
|
+
|
134
|
+
### Text on white background
|
135
|
+
|
136
|
+
```html
|
137
|
+
<div class="text-blue mb-2">
|
138
|
+
.text-blue on white
|
139
|
+
</div>
|
140
|
+
<div class="text-gray-dark mb-2">
|
141
|
+
.text-gray-dark on white
|
142
|
+
</div>
|
143
|
+
<div class="text-gray mb-2">
|
144
|
+
.text-gray on white
|
145
|
+
</div>
|
146
|
+
<div class="text-red mb-2">
|
147
|
+
.text-red on white
|
148
|
+
</div>
|
149
|
+
<div class="text-orange mb-2">
|
150
|
+
.text-orange on white
|
151
|
+
</div>
|
152
|
+
<span class="float-left text-red tooltipped tooltipped-n" aria-label="Does not meet accessibility standards"><%= octicon("alert") %></span>
|
153
|
+
<div class="text-orange-light mb-2">
|
154
|
+
.text-orange-light on white
|
155
|
+
</div>
|
156
|
+
<span class="float-left text-red tooltipped tooltipped-n" aria-label="Does not meet accessibility standards"><%= octicon("alert") %></span>
|
157
|
+
<div class="text-green mb-2 ml-4">
|
158
|
+
.text-green on white
|
159
|
+
</div>
|
160
|
+
<div class="text-purple mb-2">
|
161
|
+
.text-purple on white
|
162
|
+
</div>
|
163
|
+
```
|
164
|
+
|
165
|
+
### Text on colored backgrounds
|
166
|
+
|
167
|
+
```html
|
168
|
+
<div class="text-white bg-blue mb-2">
|
169
|
+
.text-white on .bg-blue
|
170
|
+
</div>
|
171
|
+
<div class="bg-blue-light mb-2">
|
172
|
+
.text-gray-dark on .bg-blue-light
|
173
|
+
</div>
|
174
|
+
<div class="text-white bg-red mb-2">
|
175
|
+
.text-white on .bg-red
|
176
|
+
</div>
|
177
|
+
<div class="text-red bg-red-light mb-2">
|
178
|
+
.text-red on .bg-red-light
|
179
|
+
</div>
|
180
|
+
<div class="bg-green-light mb-2">
|
181
|
+
.text-gray-dark on .bg-green-light
|
182
|
+
</div>
|
183
|
+
<div class="bg-yellow mb-2">
|
184
|
+
.text-gray-dark on .bg-yellow
|
185
|
+
</div>
|
186
|
+
<div class="bg-yellow-light mb-2">
|
187
|
+
.text-gray-dark on .bg-yellow-light
|
188
|
+
</div>
|
189
|
+
<div class="text-white bg-purple mb-2">
|
190
|
+
.text-white on .bg-purple
|
191
|
+
</div>
|
192
|
+
<div class="text-white bg-gray-dark mb-2">
|
193
|
+
.text-white on .bg-gray-dark
|
194
|
+
</div>
|
195
|
+
<div class="bg-gray">
|
196
|
+
.text-gray-dark on .bg-gray
|
197
|
+
</div>
|
198
|
+
```
|
199
|
+
|
200
|
+
## Link colors
|
201
|
+
|
202
|
+
Base link styles turn links blue and apply an underline on hover. You can override the base link styles with text color utilities and the following link utilities. **Bear in mind that link styles are easier for more people to see and interact with when the changes in styles do not rely on color alone.**
|
203
|
+
|
204
|
+
Use `link-gray` to turn the link color to `$text-gray` and remain hover on blue.
|
205
|
+
|
206
|
+
```html
|
207
|
+
<a class="link-gray" href="#url">link-gray</a>
|
208
|
+
```
|
209
|
+
|
210
|
+
Use `link-gray-dark` to turn the link color to `$text-gray-dark` and remain hover on blue.
|
211
|
+
|
212
|
+
```html
|
213
|
+
<a class="link-gray-dark" href="#url">link-gray-dark</a>
|
214
|
+
```
|
215
|
+
|
216
|
+
Use `.muted-link` to turn the link light gray in color, and blue on hover or focus with no underline.
|
217
|
+
|
218
|
+
```html
|
219
|
+
<a class="muted-link" href="#url">muted-link</a>
|
220
|
+
```
|
221
|
+
|
222
|
+
Use `link-hover-blue` to make any text color used with links to turn blue on hover. This is useful when you want only part of a link to turn blue on hover.
|
223
|
+
|
224
|
+
```html
|
225
|
+
<a class="text-gray-dark no-underline" href="#url">
|
226
|
+
A link with only part of it is <span class="link-hover-blue">blue on hover</span>.
|
227
|
+
</a>
|
228
|
+
```
|
229
|
+
|
230
|
+
## Border colors
|
231
|
+
|
232
|
+
Border colors are documented on the [border utilities page](/styleguide/css/styles/core/utilities/borders#border-width-style-and-color-utilities).
|
@@ -0,0 +1,665 @@
|
|
1
|
+
---
|
2
|
+
title: Flexbox
|
3
|
+
status: New release
|
4
|
+
source: /app/assets/stylesheets/primer-core/utilities/lib/layout.scss
|
5
|
+
status_issue: https://github.com/github/design-systems/issues/157
|
6
|
+
---
|
7
|
+
|
8
|
+
Flex utilities can be used to apply `flexbox` behaviors to elements by using utility classes.
|
9
|
+
|
10
|
+
{:toc}
|
11
|
+
|
12
|
+
## Required reading
|
13
|
+
|
14
|
+
Before using these utilities, **you should be familiar with CSS3 Flexible Box spec**. If you are not, check out MDN's guide:
|
15
|
+
|
16
|
+
:book: **[Using CSS Flexible Boxes](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes)**
|
17
|
+
|
18
|
+
## Flex container
|
19
|
+
|
20
|
+
Use these classes to make an element lay out its content using the flexbox model. Each **direct** child of the flex container will become a flex item.
|
21
|
+
|
22
|
+
#### CSS
|
23
|
+
|
24
|
+
```css
|
25
|
+
.d-flex { display: flex; }
|
26
|
+
.d-inline-flex { display: inline-flex; }
|
27
|
+
```
|
28
|
+
|
29
|
+
#### Classes
|
30
|
+
|
31
|
+
| Class | Description |
|
32
|
+
| --- | --- |
|
33
|
+
| `.d-flex` | The element behaves like a block and lays out its content using the flexbox model. |
|
34
|
+
| `.d-inline-flex` | The element behaves like an inline element and lays out its content using the flexbox model. |
|
35
|
+
|
36
|
+
#### Example using `.d-flex`
|
37
|
+
|
38
|
+
```html
|
39
|
+
<!-- flex container -->
|
40
|
+
<div class="border d-flex">
|
41
|
+
<div class="p-5 border bg-gray-light">flex item 1</div>
|
42
|
+
<div class="p-5 border bg-gray-light">flex item 2</div>
|
43
|
+
<div class="p-5 border bg-gray-light">flex item 3</div>
|
44
|
+
</div>
|
45
|
+
```
|
46
|
+
|
47
|
+
#### Example using `.d-inline-flex`
|
48
|
+
|
49
|
+
```html
|
50
|
+
<!-- inline-flex container -->
|
51
|
+
<div class="border d-inline-flex">
|
52
|
+
<div class="p-5 border bg-gray-light">flex item 1</div>
|
53
|
+
<div class="p-5 border bg-gray-light">flex item 2</div>
|
54
|
+
<div class="p-5 border bg-gray-light">flex item 3</div>
|
55
|
+
</div>
|
56
|
+
```
|
57
|
+
|
58
|
+
## Flex direction
|
59
|
+
|
60
|
+
Use these classes to define the orientation of the main axis (`row` or `column`). By default, flex items will display in a row. Use `.flex-column` to change the direction of the main axis to vertical.
|
61
|
+
|
62
|
+
#### CSS
|
63
|
+
|
64
|
+
```css
|
65
|
+
.flex-row { flex-direction: row; }
|
66
|
+
.flex-row-reverse { flex-direction: row-reverse; }
|
67
|
+
.flex-column { flex-direction: column; }
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Classes
|
71
|
+
|
72
|
+
| Class | Description |
|
73
|
+
| --- | --- |
|
74
|
+
| `.flex-row` | The main axis runs left to right (default). |
|
75
|
+
| `.flex-row-reverse` | The main axis runs right to left. |
|
76
|
+
| `.flex-column` | The main axis runs top to bottom. |
|
77
|
+
|
78
|
+
#### Example using `.flex-column`
|
79
|
+
|
80
|
+
```html
|
81
|
+
<div class="border d-flex flex-column">
|
82
|
+
<div class="p-5 border bg-gray-light">Item 1</div>
|
83
|
+
<div class="p-5 border bg-gray-light">Item 2</div>
|
84
|
+
<div class="p-5 border bg-gray-light">Item 3</div>
|
85
|
+
</div>
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Example using `.flex-row`
|
89
|
+
|
90
|
+
This example uses the responsive variant `.flex-md-row` to override `.flex-column` Learn more about responsive flexbox utilities **[here](#responsive-flex-utilities)**.
|
91
|
+
|
92
|
+
```html
|
93
|
+
<div class="border d-flex flex-column flex-md-row">
|
94
|
+
<div class="p-5 border bg-gray-light">Item 1</div>
|
95
|
+
<div class="p-5 border bg-gray-light">Item 2</div>
|
96
|
+
<div class="p-5 border bg-gray-light">Item 3</div>
|
97
|
+
</div>
|
98
|
+
```
|
99
|
+
|
100
|
+
#### Example using `.flex-row-reverse`
|
101
|
+
|
102
|
+
This example uses the responsive variant `.flex-md-row-reverse` to override `.flex-column` Learn more about responsive flexbox utilities **[here](#responsive-flex-utilities)**.
|
103
|
+
|
104
|
+
```html
|
105
|
+
<div class="border d-flex flex-column flex-md-row-reverse">
|
106
|
+
<div class="p-5 border bg-gray-light">Item 1</div>
|
107
|
+
<div class="p-5 border bg-gray-light">Item 2</div>
|
108
|
+
<div class="p-5 border bg-gray-light">Item 3</div>
|
109
|
+
</div>
|
110
|
+
```
|
111
|
+
|
112
|
+
## Flex wrap
|
113
|
+
|
114
|
+
You can choose whether flex items are forced into a single line or wrapped onto multiple lines.
|
115
|
+
|
116
|
+
#### CSS
|
117
|
+
|
118
|
+
```css
|
119
|
+
.flex-wrap { flex-wrap: wrap; }
|
120
|
+
.flex-nowrap { flex-wrap: nowrap; }
|
121
|
+
```
|
122
|
+
|
123
|
+
#### Classes
|
124
|
+
|
125
|
+
| Class | Description |
|
126
|
+
| --- | --- |
|
127
|
+
| `.flex-wrap` | Flex items will break onto multiple lines (default) |
|
128
|
+
| `.flex-nowrap` | Flex items are laid out in a single line, even if they overflow |
|
129
|
+
|
130
|
+
#### `flex-wrap` example
|
131
|
+
|
132
|
+
```html
|
133
|
+
<div class="border d-flex flex-wrap">
|
134
|
+
<div class="p-5 px-6 border bg-gray-light">1</div>
|
135
|
+
<div class="p-5 px-6 border bg-gray-light">2</div>
|
136
|
+
<div class="p-5 px-6 border bg-gray-light">3</div>
|
137
|
+
<div class="p-5 px-6 border bg-gray-light">4</div>
|
138
|
+
<div class="p-5 px-6 border bg-gray-light">5</div>
|
139
|
+
<div class="p-5 px-6 border bg-gray-light">6</div>
|
140
|
+
<div class="p-5 px-6 border bg-gray-light">7</div>
|
141
|
+
<div class="p-5 px-6 border bg-gray-light">8</div>
|
142
|
+
<div class="p-5 px-6 border bg-gray-light">9</div>
|
143
|
+
</div>
|
144
|
+
```
|
145
|
+
|
146
|
+
#### `flex-nowrap` example
|
147
|
+
|
148
|
+
```html
|
149
|
+
<div class="border d-flex flex-nowrap">
|
150
|
+
<div class="p-5 px-6 border bg-gray-light">1</div>
|
151
|
+
<div class="p-5 px-6 border bg-gray-light">2</div>
|
152
|
+
<div class="p-5 px-6 border bg-gray-light">3</div>
|
153
|
+
<div class="p-5 px-6 border bg-gray-light">4</div>
|
154
|
+
<div class="p-5 px-6 border bg-gray-light">5</div>
|
155
|
+
<div class="p-5 px-6 border bg-gray-light">6</div>
|
156
|
+
<div class="p-5 px-6 border bg-gray-light">7</div>
|
157
|
+
<div class="p-5 px-6 border bg-gray-light">8</div>
|
158
|
+
<div class="p-5 px-6 border bg-gray-light">9</div>
|
159
|
+
</div>
|
160
|
+
```
|
161
|
+
|
162
|
+
## Justify content
|
163
|
+
|
164
|
+
Use these classes to distribute space between and around flex items along the **main axis** of the container.
|
165
|
+
|
166
|
+
#### CSS
|
167
|
+
|
168
|
+
```CSS
|
169
|
+
.flex-justify-start { justify-content: flex-start; }
|
170
|
+
.flex-justify-end { justify-content: flex-end; }
|
171
|
+
.flex-justify-center { justify-content: center; }
|
172
|
+
.flex-justify-between { justify-content: space-between; }
|
173
|
+
.flex-justify-around { justify-content: space-around; }
|
174
|
+
```
|
175
|
+
|
176
|
+
#### Classes
|
177
|
+
|
178
|
+
| Class | Default behavior |
|
179
|
+
| --- | --- |
|
180
|
+
| `.flex-justify-start` | Justify all items to the left |
|
181
|
+
| `.flex-justify-end` | Justify all items to the right |
|
182
|
+
| `.flex-justify-center` | Justify items to the center of the container |
|
183
|
+
| `.flex-justify-between` | Distribute items evenly. First item is on the start line, last item is on the end line. |
|
184
|
+
| `.flex-justify-around` | Distribute items evenly with equal space around them |
|
185
|
+
|
186
|
+
#### flex-justify-start
|
187
|
+
|
188
|
+
Use `.flex-justify-start` to align items to the start line. By default this will be on the left side of the container. If you are using `.flex-column`, the end line will be at the top of the container.
|
189
|
+
|
190
|
+
```html
|
191
|
+
<div class="border d-flex flex-justify-start">
|
192
|
+
<div class="p-5 border bg-gray-light">1</div>
|
193
|
+
<div class="p-5 border bg-gray-light">2</div>
|
194
|
+
<div class="p-5 border bg-gray-light">3</div>
|
195
|
+
</div>
|
196
|
+
```
|
197
|
+
|
198
|
+
#### flex-justify-end
|
199
|
+
|
200
|
+
Use `.flex-justify-end` to align items to the end line. By default this will be on the right side of the container. If you are using `.flex-column`, the end line will be at the bottom of the container.
|
201
|
+
|
202
|
+
```html
|
203
|
+
<div class="border d-flex flex-justify-end">
|
204
|
+
<div class="p-5 border bg-gray-light">1</div>
|
205
|
+
<div class="p-5 border bg-gray-light">2</div>
|
206
|
+
<div class="p-5 border bg-gray-light">3</div>
|
207
|
+
</div>
|
208
|
+
```
|
209
|
+
|
210
|
+
#### flex-justify-center
|
211
|
+
|
212
|
+
Use `.flex-justify-center` to align items in the middle of the container.
|
213
|
+
|
214
|
+
```html
|
215
|
+
<div class="border d-flex flex-justify-center">
|
216
|
+
<div class="p-5 border bg-gray-light">1</div>
|
217
|
+
<div class="p-5 border bg-gray-light">2</div>
|
218
|
+
<div class="p-5 border bg-gray-light">3</div>
|
219
|
+
</div>
|
220
|
+
```
|
221
|
+
|
222
|
+
#### flex-justify-between
|
223
|
+
|
224
|
+
Use `.flex-justify-between` to distribute items evenly in the container. The first items will be on the start line and the last item will be on the end line.
|
225
|
+
|
226
|
+
```html
|
227
|
+
<div class="border d-flex flex-justify-between">
|
228
|
+
<div class="p-5 border bg-gray-light">1</div>
|
229
|
+
<div class="p-5 border bg-gray-light">2</div>
|
230
|
+
<div class="p-5 border bg-gray-light">3</div>
|
231
|
+
</div>
|
232
|
+
```
|
233
|
+
|
234
|
+
#### flex-justify-around
|
235
|
+
|
236
|
+
Use `.flex-justify-around` to distribute items evenly, with an equal amount of space around them. Visually the spaces won't look equal, since each item has the same unit of space around it. For example, the first item only has one unit of space between it and the start line, but it has two units of space between it and the next item.
|
237
|
+
|
238
|
+
```html
|
239
|
+
<div class="border d-flex flex-justify-around">
|
240
|
+
<div class="p-5 border bg-gray-light">1</div>
|
241
|
+
<div class="p-5 border bg-gray-light">2</div>
|
242
|
+
<div class="p-5 border bg-gray-light">3</div>
|
243
|
+
</div>
|
244
|
+
```
|
245
|
+
|
246
|
+
## Align items
|
247
|
+
|
248
|
+
Use these classes to align items on the **cross axis**.
|
249
|
+
|
250
|
+
The cross axis runs perpendicular to the main axis. By default the main axis runs horizontally, so your items will align vertically on the cross axis. If you use [flex-column](#flex-direction) to make the main axis run vertically, your items will be aligned horizontally.
|
251
|
+
|
252
|
+
#### CSS
|
253
|
+
|
254
|
+
```css
|
255
|
+
.flex-items-start { align-items: flex-start; }
|
256
|
+
.flex-items-end { align-items: flex-end; }
|
257
|
+
.flex-items-center { align-items: center; }
|
258
|
+
.flex-items-baseline { align-items: baseline; }
|
259
|
+
.flex-items-stretch { align-items: stretch; }
|
260
|
+
```
|
261
|
+
|
262
|
+
#### Classes
|
263
|
+
|
264
|
+
| Class | Behavior |
|
265
|
+
| --- | --- |
|
266
|
+
| `.flex-items-start` | Align items to the start of the cross axis |
|
267
|
+
| `.flex-items-end` | Align items to the end of the cross axis |
|
268
|
+
| `.flex-items-center` | Align items to the center of the cross axis |
|
269
|
+
| `.flex-items-baseline` | Align items along their baselines |
|
270
|
+
| `.flex-items-stretch` | Stretch items from start of cross axis to end of cross axis |
|
271
|
+
|
272
|
+
#### flex-items-start
|
273
|
+
|
274
|
+
```html
|
275
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-start">
|
276
|
+
<div class="p-5 border bg-gray-light">1</div>
|
277
|
+
<div class="p-5 border bg-gray-light">2</div>
|
278
|
+
<div class="p-5 border bg-gray-light">3</div>
|
279
|
+
<div class="p-5 border bg-gray-light">4</div>
|
280
|
+
</div>
|
281
|
+
```
|
282
|
+
|
283
|
+
#### flex-items-end
|
284
|
+
|
285
|
+
```html
|
286
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-end">
|
287
|
+
<div class="p-5 border bg-gray-light">1</div>
|
288
|
+
<div class="p-5 border bg-gray-light">2</div>
|
289
|
+
<div class="p-5 border bg-gray-light">3</div>
|
290
|
+
<div class="p-5 border bg-gray-light">4</div>
|
291
|
+
</div>
|
292
|
+
```
|
293
|
+
|
294
|
+
#### flex-items-center
|
295
|
+
|
296
|
+
```html
|
297
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-center">
|
298
|
+
<div class="p-5 border bg-gray-light">1</div>
|
299
|
+
<div class="p-5 border bg-gray-light">2</div>
|
300
|
+
<div class="p-5 border bg-gray-light">3</div>
|
301
|
+
<div class="p-5 border bg-gray-light">4</div>
|
302
|
+
</div>
|
303
|
+
```
|
304
|
+
|
305
|
+
#### flex-items-baseline
|
306
|
+
|
307
|
+
With `.flex-items-baseline`, items will be aligned along their baselines even if they have different font sizes.
|
308
|
+
|
309
|
+
```html
|
310
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-baseline">
|
311
|
+
<div class="p-5 border bg-gray-light f1">1</div>
|
312
|
+
<div class="p-5 border bg-gray-light">2</div>
|
313
|
+
<div class="p-5 border bg-gray-light f3">3</div>
|
314
|
+
<div class="p-5 border bg-gray-light">4</div>
|
315
|
+
</div>
|
316
|
+
```
|
317
|
+
|
318
|
+
#### flex-items-stretch
|
319
|
+
|
320
|
+
```html
|
321
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-stretch">
|
322
|
+
<div class="p-5 border bg-gray-light">1</div>
|
323
|
+
<div class="p-5 border bg-gray-light">2</div>
|
324
|
+
<div class="p-5 border bg-gray-light">3</div>
|
325
|
+
<div class="p-5 border bg-gray-light">4</div>
|
326
|
+
</div>
|
327
|
+
```
|
328
|
+
|
329
|
+
## Align content
|
330
|
+
|
331
|
+
When the main axis wraps, this creates multiple main axis lines and adds extra space in the cross axis. Use these classes to align the lines of the main axis on the cross axis.
|
332
|
+
|
333
|
+
#### CSS
|
334
|
+
|
335
|
+
```css
|
336
|
+
.flex-content-start { align-content: flex-start; }
|
337
|
+
.flex-content-end { align-content: flex-end; }
|
338
|
+
.flex-content-center { align-content: center; }
|
339
|
+
.flex-content-between { align-content: space-between; }
|
340
|
+
.flex-content-around { align-content: space-around; }
|
341
|
+
.flex-content-stretch { align-content: stretch; }
|
342
|
+
```
|
343
|
+
|
344
|
+
#### Classes
|
345
|
+
|
346
|
+
| Class | Description |
|
347
|
+
| --- | --- |
|
348
|
+
| `.flex-content-start` | Align content to the start of the cross axis |
|
349
|
+
| `.flex-content-end` | Align content to the end of the cross axis |
|
350
|
+
| `.flex-content-center` | Align content to the center of the cross axis |
|
351
|
+
| `.flex-content-between` | Distribute content evenly. First line is on the start of the cross axis, last line is on the end of the cross axis. |
|
352
|
+
| `.flex-content-around` | Stretch items from the start of the cross axis to the end of the cross axis. |
|
353
|
+
| `.flex-content-stretch` | Lines stretch to occupy available space. |
|
354
|
+
|
355
|
+
#### flex-content-start
|
356
|
+
|
357
|
+
```html
|
358
|
+
<div style="min-height: 300px;" class="border d-flex flex-wrap flex-content-start">
|
359
|
+
<div class="p-5 border bg-gray-light">1</div>
|
360
|
+
<div class="p-5 border bg-gray-light">2</div>
|
361
|
+
<div class="p-5 border bg-gray-light">3</div>
|
362
|
+
<div class="p-5 border bg-gray-light">4</div>
|
363
|
+
<div class="p-5 border bg-gray-light">5</div>
|
364
|
+
<div class="p-5 border bg-gray-light">6</div>
|
365
|
+
<div class="p-5 border bg-gray-light">7</div>
|
366
|
+
<div class="p-5 border bg-gray-light">8</div>
|
367
|
+
<div class="p-5 border bg-gray-light">9</div>
|
368
|
+
<div class="p-5 border bg-gray-light">10</div>
|
369
|
+
<div class="p-5 border bg-gray-light">11</div>
|
370
|
+
<div class="p-5 border bg-gray-light">12</div>
|
371
|
+
</div>
|
372
|
+
```
|
373
|
+
|
374
|
+
#### flex-content-end
|
375
|
+
|
376
|
+
```html
|
377
|
+
<div style="min-height: 300px;" class="border d-flex flex-wrap flex-content-end">
|
378
|
+
<div class="p-5 border bg-gray-light">1</div>
|
379
|
+
<div class="p-5 border bg-gray-light">2</div>
|
380
|
+
<div class="p-5 border bg-gray-light">3</div>
|
381
|
+
<div class="p-5 border bg-gray-light">4</div>
|
382
|
+
<div class="p-5 border bg-gray-light">5</div>
|
383
|
+
<div class="p-5 border bg-gray-light">6</div>
|
384
|
+
<div class="p-5 border bg-gray-light">7</div>
|
385
|
+
<div class="p-5 border bg-gray-light">8</div>
|
386
|
+
<div class="p-5 border bg-gray-light">9</div>
|
387
|
+
<div class="p-5 border bg-gray-light">10</div>
|
388
|
+
<div class="p-5 border bg-gray-light">11</div>
|
389
|
+
<div class="p-5 border bg-gray-light">12</div>
|
390
|
+
</div>
|
391
|
+
```
|
392
|
+
|
393
|
+
#### flex-content-center
|
394
|
+
|
395
|
+
```html
|
396
|
+
<div style="min-height: 300px;" class="border d-flex flex-wrap flex-content-center">
|
397
|
+
<div class="p-5 border bg-gray-light">1</div>
|
398
|
+
<div class="p-5 border bg-gray-light">2</div>
|
399
|
+
<div class="p-5 border bg-gray-light">3</div>
|
400
|
+
<div class="p-5 border bg-gray-light">4</div>
|
401
|
+
<div class="p-5 border bg-gray-light">5</div>
|
402
|
+
<div class="p-5 border bg-gray-light">6</div>
|
403
|
+
<div class="p-5 border bg-gray-light">7</div>
|
404
|
+
<div class="p-5 border bg-gray-light">8</div>
|
405
|
+
<div class="p-5 border bg-gray-light">9</div>
|
406
|
+
<div class="p-5 border bg-gray-light">10</div>
|
407
|
+
<div class="p-5 border bg-gray-light">11</div>
|
408
|
+
<div class="p-5 border bg-gray-light">12</div>
|
409
|
+
</div>
|
410
|
+
```
|
411
|
+
|
412
|
+
#### flex-content-between
|
413
|
+
|
414
|
+
```html
|
415
|
+
<div style="min-height: 300px;" class="border d-flex flex-wrap flex-content-between">
|
416
|
+
<div class="p-5 border bg-gray-light">1</div>
|
417
|
+
<div class="p-5 border bg-gray-light">2</div>
|
418
|
+
<div class="p-5 border bg-gray-light">3</div>
|
419
|
+
<div class="p-5 border bg-gray-light">4</div>
|
420
|
+
<div class="p-5 border bg-gray-light">5</div>
|
421
|
+
<div class="p-5 border bg-gray-light">6</div>
|
422
|
+
<div class="p-5 border bg-gray-light">7</div>
|
423
|
+
<div class="p-5 border bg-gray-light">8</div>
|
424
|
+
<div class="p-5 border bg-gray-light">9</div>
|
425
|
+
<div class="p-5 border bg-gray-light">10</div>
|
426
|
+
<div class="p-5 border bg-gray-light">11</div>
|
427
|
+
<div class="p-5 border bg-gray-light">12</div>
|
428
|
+
</div>
|
429
|
+
```
|
430
|
+
|
431
|
+
#### flex-content-around
|
432
|
+
|
433
|
+
```html
|
434
|
+
<div style="min-height: 300px;" class="border d-flex flex-wrap flex-content-around">
|
435
|
+
<div class="p-5 border bg-gray-light">1</div>
|
436
|
+
<div class="p-5 border bg-gray-light">2</div>
|
437
|
+
<div class="p-5 border bg-gray-light">3</div>
|
438
|
+
<div class="p-5 border bg-gray-light">4</div>
|
439
|
+
<div class="p-5 border bg-gray-light">5</div>
|
440
|
+
<div class="p-5 border bg-gray-light">6</div>
|
441
|
+
<div class="p-5 border bg-gray-light">7</div>
|
442
|
+
<div class="p-5 border bg-gray-light">8</div>
|
443
|
+
<div class="p-5 border bg-gray-light">9</div>
|
444
|
+
<div class="p-5 border bg-gray-light">10</div>
|
445
|
+
<div class="p-5 border bg-gray-light">11</div>
|
446
|
+
<div class="p-5 border bg-gray-light">12</div>
|
447
|
+
</div>
|
448
|
+
```
|
449
|
+
|
450
|
+
#### flex-content-stretch
|
451
|
+
|
452
|
+
```html
|
453
|
+
<div style="min-height: 300px;" class="border d-flex flex-wrap flex-content-stretch">
|
454
|
+
<div class="p-5 border bg-gray-light">1</div>
|
455
|
+
<div class="p-5 border bg-gray-light">2</div>
|
456
|
+
<div class="p-5 border bg-gray-light">3</div>
|
457
|
+
<div class="p-5 border bg-gray-light">4</div>
|
458
|
+
<div class="p-5 border bg-gray-light">5</div>
|
459
|
+
<div class="p-5 border bg-gray-light">6</div>
|
460
|
+
<div class="p-5 border bg-gray-light">7</div>
|
461
|
+
<div class="p-5 border bg-gray-light">8</div>
|
462
|
+
<div class="p-5 border bg-gray-light">9</div>
|
463
|
+
<div class="p-5 border bg-gray-light">10</div>
|
464
|
+
<div class="p-5 border bg-gray-light">11</div>
|
465
|
+
<div class="p-5 border bg-gray-light">12</div>
|
466
|
+
</div>
|
467
|
+
```
|
468
|
+
|
469
|
+
## Flex
|
470
|
+
|
471
|
+
Use this class to specify the ability of a flex item to alter its dimensions to fill available space.
|
472
|
+
|
473
|
+
```CSS
|
474
|
+
.flex-auto { flex: 1 1 auto; }
|
475
|
+
```
|
476
|
+
|
477
|
+
| Class | Description |
|
478
|
+
| --- | --- |
|
479
|
+
| `.flex-auto` | Sets default values for `flex-grow` (1), `flex-shrink` (1) and `flex-basis` (auto) |
|
480
|
+
|
481
|
+
#### flex-auto
|
482
|
+
|
483
|
+
```html
|
484
|
+
<div class="border d-flex">
|
485
|
+
<div class="p-5 border bg-gray-light flex-auto">.flex-auto</div>
|
486
|
+
<div class="p-5 border bg-gray-light flex-auto">.flex-auto</div>
|
487
|
+
<div class="p-5 border bg-gray-light flex-auto">.flex-auto</div>
|
488
|
+
</div>
|
489
|
+
```
|
490
|
+
|
491
|
+
## Align self
|
492
|
+
|
493
|
+
Use these classes to adjust the alignment of an individual flex item on the cross axis. This overrides any `align-items` property applied to the flex container.
|
494
|
+
|
495
|
+
#### CSS
|
496
|
+
|
497
|
+
```css
|
498
|
+
.flex-self-auto { align-self: auto; }
|
499
|
+
.flex-self-start { align-self: flex-start; }
|
500
|
+
.flex-self-end { align-self: flex-end; }
|
501
|
+
.flex-self-center { align-self: center; }
|
502
|
+
.flex-self-baseline { align-self: baseline; }
|
503
|
+
.flex-self-stretch { align-self: stretch; }
|
504
|
+
```
|
505
|
+
|
506
|
+
#### Classes
|
507
|
+
|
508
|
+
| Class | Description |
|
509
|
+
| --- | --- |
|
510
|
+
| `.flex-self-auto` | Inherit alignment from parent |
|
511
|
+
| `.flex-self-start` | Align to the start of the cross axis |
|
512
|
+
| `.flex-self-end` | Align to the end of the cross axis |
|
513
|
+
| `.flex-self-center` | Align to center of cross axis |
|
514
|
+
| `.flex-self-baseline` | Align baseline to the start of the cross axis |
|
515
|
+
| `.flex-self-stretch` | Stretch item from start of cross axis to end of cross axis. |
|
516
|
+
|
517
|
+
#### flex-self-auto
|
518
|
+
|
519
|
+
```html
|
520
|
+
<div style="min-height: 150px;" class="border d-flex">
|
521
|
+
<div class="p-5 border bg-gray-light flex-self-auto">.flex-self-auto</div>
|
522
|
+
<div class="p-5 border bg-gray-light"> </div>
|
523
|
+
<div class="p-5 border bg-gray-light"> </div>
|
524
|
+
</div>
|
525
|
+
```
|
526
|
+
|
527
|
+
#### flex-self-start
|
528
|
+
|
529
|
+
```html
|
530
|
+
<div style="min-height: 150px;" class="border d-flex">
|
531
|
+
<div class="p-5 border bg-gray-light flex-self-start">.flex-self-start</div>
|
532
|
+
<div class="p-5 border bg-gray-light"> </div>
|
533
|
+
<div class="p-5 border bg-gray-light"> </div>
|
534
|
+
</div>
|
535
|
+
```
|
536
|
+
|
537
|
+
#### flex-self-end
|
538
|
+
|
539
|
+
```html
|
540
|
+
<div style="min-height: 150px;" class="border d-flex">
|
541
|
+
<div class="p-5 border bg-gray-light flex-self-end">.flex-self-end</div>
|
542
|
+
<div class="p-5 border bg-gray-light"> </div>
|
543
|
+
<div class="p-5 border bg-gray-light"> </div>
|
544
|
+
</div>
|
545
|
+
```
|
546
|
+
|
547
|
+
#### flex-self-center
|
548
|
+
|
549
|
+
```html
|
550
|
+
<div style="min-height: 150px;" class="border d-flex">
|
551
|
+
<div class="p-5 border bg-gray-light flex-self-center">.flex-self-center</div>
|
552
|
+
<div class="p-5 border bg-gray-light"> </div>
|
553
|
+
<div class="p-5 border bg-gray-light"> </div>
|
554
|
+
</div>
|
555
|
+
```
|
556
|
+
|
557
|
+
#### flex-self-baseline
|
558
|
+
|
559
|
+
```html
|
560
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-end">
|
561
|
+
<div class="p-5 border bg-gray-light flex-self-baseline f4">.flex-self-baseline</div>
|
562
|
+
<div class="p-5 border bg-gray-light f1">item</div>
|
563
|
+
<div class="p-5 border bg-gray-light f00">item</div>
|
564
|
+
</div>
|
565
|
+
```
|
566
|
+
|
567
|
+
#### flex-self-stretch
|
568
|
+
|
569
|
+
```html
|
570
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-start">
|
571
|
+
<div class="p-5 border bg-gray-light flex-self-stretch">.flex-self-stretch</div>
|
572
|
+
<div class="p-5 border bg-gray-light"> </div>
|
573
|
+
<div class="p-5 border bg-gray-light"> </div>
|
574
|
+
</div>
|
575
|
+
```
|
576
|
+
|
577
|
+
## Responsive flex utilities
|
578
|
+
|
579
|
+
All flexbox utilities can be adjust per [breakpoint](/styleguide/css/modules/grid#breakpoints) using the following formulas:
|
580
|
+
|
581
|
+
- `d-[breakpoint]-[property]` for `display`
|
582
|
+
- `flex-[breakpoint]-[property]-[behavior]` for various flex properties
|
583
|
+
- `flex-[breakpoint]-item-equal` for equal width and equal height flex items
|
584
|
+
|
585
|
+
Each responsive style is applied to the specified breakpoint and up.
|
586
|
+
|
587
|
+
#### Example classes
|
588
|
+
|
589
|
+
```css
|
590
|
+
/* Example classes */
|
591
|
+
|
592
|
+
.d-sm-flex {}
|
593
|
+
.d-md-inline-flex {}
|
594
|
+
|
595
|
+
.flex-lg-row {}
|
596
|
+
.flex-xl-column {}
|
597
|
+
|
598
|
+
.flex-sm-wrap {}
|
599
|
+
.flex-lg-nowrap {}
|
600
|
+
|
601
|
+
.flex-lg-self-start {}
|
602
|
+
|
603
|
+
.flex-md-item-equal {}
|
604
|
+
```
|
605
|
+
|
606
|
+
#### Example usage
|
607
|
+
|
608
|
+
Mixing flex properties:
|
609
|
+
|
610
|
+
```html
|
611
|
+
<div style="min-height: 150px;" class="border d-flex flex-items-start flex-md-items-center flex-justify-start flex-lg-justify-between">
|
612
|
+
<div class="p-5 border bg-gray-light flex-md-self-stretch">.flex-self-stretch</div>
|
613
|
+
<div class="p-5 border bg-gray-light"> </div>
|
614
|
+
<div class="p-5 border bg-gray-light"> </div>
|
615
|
+
</div>
|
616
|
+
```
|
617
|
+
|
618
|
+
Using the equal width, equal height utilities:
|
619
|
+
|
620
|
+
```html
|
621
|
+
<div class="border d-flex">
|
622
|
+
<div class="flex-md-item-equal p-3 border bg-gray-light">Stuff and things</div>
|
623
|
+
<div class="flex-md-item-equal p-3 border bg-gray-light">More stuff<br> on multiple lines</div>
|
624
|
+
<div class="flex-md-item-equal p-3 border bg-gray-light">Hi mom</div>
|
625
|
+
</div>
|
626
|
+
```
|
627
|
+
|
628
|
+
## Example components
|
629
|
+
|
630
|
+
The flex utilities can be used to create a number of components. Here are some examples.
|
631
|
+
|
632
|
+
### Media object
|
633
|
+
|
634
|
+
You can use flex utilities to make a simple media object, like this:
|
635
|
+
|
636
|
+
```html
|
637
|
+
<div class="border d-flex flex-items-center p-4">
|
638
|
+
<div class="p-5 border bg-gray-light">image</div>
|
639
|
+
<p class="pl-4 m-0"><b>Body</b> Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison.</p>
|
640
|
+
</div>
|
641
|
+
```
|
642
|
+
|
643
|
+
### Responsive media object
|
644
|
+
|
645
|
+
Here is an example of a media object that is **vertically centered on large screens**, but converts to a stacked column layout on small screens.
|
646
|
+
|
647
|
+
```html
|
648
|
+
<div class="border p-3 d-flex flex-column flex-md-row flex-md-items-center">
|
649
|
+
<div class="pr-0 pr-md-3 mb-3 mb-md-0 d-flex flex-justify-center flex-md-justify-start">
|
650
|
+
<img style="max-width:100px; max-height:100px;" src="/images/gravatars/gravatar-user-420.png" />
|
651
|
+
</div>
|
652
|
+
<div class="d-flex text-center text-md-left">
|
653
|
+
<p><b>Body</b> Bacon ipsum dolor sit amet chuck prosciutto landjaeger ham hock filet mignon shoulder hamburger pig venison.</p>
|
654
|
+
</div>
|
655
|
+
<div class="ml-md-3 d-flex flex-justify-center">
|
656
|
+
<%= octicon "mark-github", :height => '32' %>
|
657
|
+
</div>
|
658
|
+
</div>
|
659
|
+
```
|
660
|
+
|
661
|
+
## Flexbox bugs
|
662
|
+
|
663
|
+
This section lists flexbox bugs that affect browsers we [currently support](.../styles#user-content-browser-support).
|
664
|
+
|
665
|
+
**1. Minimum content sizing of flex items not honored:** Some browsers don't respect flex item size. Instead of respecting the minimum content size, items shrink below their minimum size which can create some undesirable results, such as overflowing text. The workaround is to apply `flex-shrink: 0;` to the items using `d-flex`. This can be applied with the `flex-shrink-0` utility. For more information read [philipwalton/flexbugs](https://github.com/philipwalton/flexbugs#1-minimum-content-sizing-of-flex-items-not-honored).
|