jekyll-theme-primer 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/_layouts/home.html +4 -0
- data/_layouts/page.html +4 -0
- data/_layouts/post.html +4 -0
- data/_sass/primer-base/lib/base.scss +6 -0
- data/_sass/primer-base/lib/normalize.scss +1 -1
- data/_sass/primer-layout/lib/grid-offset.scss +12 -23
- data/_sass/primer-support/lib/mixins/layout.scss +18 -12
- data/_sass/primer-support/lib/variables/layout.scss +7 -1
- data/_sass/primer-utilities/index.scss +1 -0
- data/_sass/primer-utilities/lib/animations.scss +1 -0
- data/_sass/primer-utilities/lib/borders.scss +71 -36
- data/_sass/primer-utilities/lib/details.scss +18 -0
- data/_sass/primer-utilities/lib/flexbox.scss +45 -73
- data/_sass/primer-utilities/lib/layout.scss +12 -27
- data/_sass/primer-utilities/lib/margin.scss +42 -75
- data/_sass/primer-utilities/lib/padding.scss +26 -56
- data/_sass/primer-utilities/lib/typography.scss +22 -23
- data/_sass/primer-utilities/lib/visibility-display.scss +21 -45
- metadata +15 -43
- data/_sass/primer-base/LICENSE +0 -21
- data/_sass/primer-base/README.md +0 -48
- data/_sass/primer-base/build/build.css +0 -1
- data/_sass/primer-base/build/index.js +0 -1
- data/_sass/primer-base/package.json +0 -73
- data/_sass/primer-layout/LICENSE +0 -21
- data/_sass/primer-layout/README.md +0 -137
- data/_sass/primer-layout/build/build.css +0 -1
- data/_sass/primer-layout/build/index.js +0 -1
- data/_sass/primer-layout/docs/grid.md +0 -392
- data/_sass/primer-layout/package.json +0 -71
- data/_sass/primer-markdown/LICENSE +0 -21
- data/_sass/primer-markdown/README.md +0 -218
- data/_sass/primer-markdown/build/build.css +0 -1
- data/_sass/primer-markdown/build/index.js +0 -1
- data/_sass/primer-markdown/package.json +0 -74
- data/_sass/primer-support/LICENSE +0 -21
- data/_sass/primer-support/README.md +0 -56
- data/_sass/primer-support/docs/breakpoints.md +0 -60
- data/_sass/primer-support/docs/color-system.md +0 -392
- data/_sass/primer-support/docs/spacing.md +0 -40
- data/_sass/primer-support/docs/typography.md +0 -90
- data/_sass/primer-support/package.json +0 -73
- data/_sass/primer-utilities/LICENSE +0 -21
- data/_sass/primer-utilities/README.md +0 -48
- data/_sass/primer-utilities/build/build.css +0 -1
- data/_sass/primer-utilities/build/index.js +0 -1
- data/_sass/primer-utilities/docs/animations.md +0 -75
- data/_sass/primer-utilities/docs/borders.md +0 -127
- data/_sass/primer-utilities/docs/box-shadow.md +0 -107
- data/_sass/primer-utilities/docs/colors.md +0 -232
- data/_sass/primer-utilities/docs/flexbox.md +0 -665
- data/_sass/primer-utilities/docs/layout.md +0 -300
- data/_sass/primer-utilities/docs/margin.md +0 -126
- data/_sass/primer-utilities/docs/padding.md +0 -110
- data/_sass/primer-utilities/docs/typography.md +0 -138
- data/_sass/primer-utilities/package.json +0 -71
@@ -1,300 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Layout
|
3
|
-
status: Stable
|
4
|
-
---
|
5
|
-
|
6
|
-
Change the document layout with display, float, alignment, and other utilities.
|
7
|
-
|
8
|
-
{:toc}
|
9
|
-
|
10
|
-
## Display
|
11
|
-
Adjust the display of an element with `.d-block`, `.d-none`, `.d-inline`, `.d-inline-block`, `.d-table`, `.d-table-cell` utilities.
|
12
|
-
|
13
|
-
```html
|
14
|
-
<div class="d-inline border">
|
15
|
-
.d-inline
|
16
|
-
<div class="d-inline-block border">
|
17
|
-
.d-inline-block
|
18
|
-
</div>
|
19
|
-
<span class="d-block border">.d-block</span>
|
20
|
-
<div class="d-table border">
|
21
|
-
<div class="d-table-cell border">
|
22
|
-
.d-table-cell
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
<div class="d-table-cell border">
|
26
|
-
.d-table-cell
|
27
|
-
</div>
|
28
|
-
<div class="d-none">
|
29
|
-
.d-none
|
30
|
-
</div>
|
31
|
-
</div>
|
32
|
-
```
|
33
|
-
|
34
|
-
There are known issues with using `display:table` and wrapping long strings, particularly in Firefox. You may need to use `table-fixed` on elements with `d-table` and apply column widths to table cells, which you can do with our [column width styles](/styleguide/css/modules/grid#column-widths).
|
35
|
-
|
36
|
-
```html
|
37
|
-
<div class="d-table table-fixed width-full">
|
38
|
-
<div class="d-table-cell border">
|
39
|
-
.d-table-cell
|
40
|
-
</div>
|
41
|
-
<div class="d-table-cell col-10 border">
|
42
|
-
d-table-cell .col-10
|
43
|
-
</div>
|
44
|
-
</div>
|
45
|
-
```
|
46
|
-
|
47
|
-
### Responsive display
|
48
|
-
A selection of display utilities are able to be applied or changed per [breakpoint](/styleguide/css/modules/grid#breakpoints). `.d-block`, `.d-none`, `.d-inline`, and `.d-inline-block` are available as responsive utilities using the following formula: `d-[breakpoint]-[property]`. For example: `d-md-inline-block`. Each responsive display utility is applied to the specified breakpoint and up.
|
49
|
-
|
50
|
-
In the following example, the `ul` element switches from `display: block` on mobile to `display: inline-block` at the `md` breakpoint, while the list items remain inline.
|
51
|
-
|
52
|
-
```html
|
53
|
-
<h5 class="d-md-inline-block">.d-md-inline-block</h5>
|
54
|
-
<ul class="d-md-inline-block border">
|
55
|
-
<li class="d-inline border">.d-inline</li>
|
56
|
-
<li class="d-inline border">.d-inline</li>
|
57
|
-
</ul>
|
58
|
-
```
|
59
|
-
|
60
|
-
### Responsive hide
|
61
|
-
Hide utilities are able to be applied or changed per breakpoint using the following formula:<br /> `hide-[breakpoint]`, for example: `hide-sm`. Hide utilities act differently from other responsive styles and are applied to each **breakpoint-range only**.
|
62
|
-
|
63
|
-
| Shorthand | Range |
|
64
|
-
| --- | --- |
|
65
|
-
| -sm | 0—544px |
|
66
|
-
| -md | 544px—768px |
|
67
|
-
| -lg | 768px—1004px |
|
68
|
-
| -xl | 1004px and above |
|
69
|
-
|
70
|
-
```html
|
71
|
-
<div>
|
72
|
-
<h3>Potato update</h3>
|
73
|
-
<span class="hide-sm hide-md">Opened by <a href="#url">broccolini</a></span>
|
74
|
-
<span class="d-md-none">Updated</span> 3 hours ago
|
75
|
-
</div>
|
76
|
-
```
|
77
|
-
|
78
|
-
### Text direction
|
79
|
-
`.direction-ltr` or `.direction-rtl` can be used to change the text direction. This is especially helpful when paired with `.d-table`, `.d-table-cell`, and `.v-align-middle` to create equal height, vertically centered, alternating content.
|
80
|
-
|
81
|
-
## Visibility
|
82
|
-
Adjust the visibility of an element with `.v-hidden` and `.v-visible`.
|
83
|
-
|
84
|
-
## Overflow
|
85
|
-
Adjust element overflow with `.overflow-hidden`, `.overflow-scroll`, and `.overflow-auto`. `.overflow-hidden` can also be used to create a new [block formatting context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context) or clear floats.
|
86
|
-
|
87
|
-
## Floats
|
88
|
-
Use `.float-left` and `.float-right` to set floats, and `.clearfix` to clear.
|
89
|
-
```html
|
90
|
-
<div class="clearfix border border-gray">
|
91
|
-
<div class="float-left border border-gray">
|
92
|
-
.float-left
|
93
|
-
</div>
|
94
|
-
<div class="float-right border border-gray">
|
95
|
-
.float-right
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
```
|
99
|
-
### Responsive floats
|
100
|
-
Float utilities can be applied or changed per [breakpoint](/styleguide/css/modules/grid#breakpoints). This can be useful for responsive layouts when you want an element to be full width on mobile but floated at a larger breakpoint.
|
101
|
-
|
102
|
-
Each responsive float utility is applied to the specified breakpoint and up, using the following formula: `float-[breakpoint]-[property]`. For example: `float-md-left`. Remember to use `.clearfix` to clear.
|
103
|
-
|
104
|
-
```html
|
105
|
-
<div class="clearfix border border-gray">
|
106
|
-
<div class="float-md-left border border-gray">
|
107
|
-
.float-md-left
|
108
|
-
</div>
|
109
|
-
<div class="float-md-right border border-gray">
|
110
|
-
.float-md-right
|
111
|
-
</div>
|
112
|
-
</div>
|
113
|
-
```
|
114
|
-
|
115
|
-
## Alignment
|
116
|
-
Adjust the alignment of an element with `.v-align-baseline`, `.v-align-top`, `.v-align-middle` or `.v-align-bottom`. The vertical-align property only applies to inline or table-cell boxes.
|
117
|
-
|
118
|
-
```html
|
119
|
-
<div class="d-table border border-gray">
|
120
|
-
<div class="d-table-cell"><h1>Potatoes</h1></div>
|
121
|
-
<div class="d-table-cell v-align-baseline">.v-align-baseline</div>
|
122
|
-
<div class="d-table-cell v-align-top">.v-align-top</div>
|
123
|
-
<div class="d-table-cell v-align-middle">.v-align-middle</div>
|
124
|
-
<div class="d-table-cell v-align-bottom">.v-align-bottom</div>
|
125
|
-
</div>
|
126
|
-
```
|
127
|
-
|
128
|
-
Use `v-align-text-top` or `v-align-text-bottom` to adjust the alignment of an element with the top or bottom of the parent element's font.
|
129
|
-
|
130
|
-
```html
|
131
|
-
<div class="border border-gray">
|
132
|
-
<h1 class="mr-1">Potatoes
|
133
|
-
<span class="f4 v-align-text-top mr-1">.v-align-text-top</span>
|
134
|
-
<span class="f4 v-align-text-bottom mr-1">.v-align-text-bottom</span>
|
135
|
-
</h1>
|
136
|
-
</div>
|
137
|
-
```
|
138
|
-
|
139
|
-
## Width and height
|
140
|
-
|
141
|
-
Use `.width-fit` to set max-width 100%.
|
142
|
-
|
143
|
-
```html
|
144
|
-
<div class="one-fourth column">
|
145
|
-
<img class="width-fit bg-gray" src="/images/gravatars/gravatar-user-420.png" alt="width fitted octocat" />
|
146
|
-
</div>
|
147
|
-
```
|
148
|
-
|
149
|
-
Use `.width-full` to set width to 100%.
|
150
|
-
|
151
|
-
```html
|
152
|
-
<div class="d-table width-full">
|
153
|
-
<div class="d-table-cell">
|
154
|
-
<input class="form-control width-full" type="text" value="Full width form field" aria-label="Sample full width form field">
|
155
|
-
</div>
|
156
|
-
</div>
|
157
|
-
```
|
158
|
-
|
159
|
-
Use `.height-fit` to set max-height 100%.
|
160
|
-
|
161
|
-
```html
|
162
|
-
<div class="one-fourth column" style="height: 100px; overflow: auto;">
|
163
|
-
<div class="p-3 height-fit border">
|
164
|
-
Bacon ipsum dolor amet meatball flank beef tail pig boudin ham hock chicken capicola. Shoulder ham spare ribs turducken pork tongue. Bresaola corned beef sausage jowl ribeye kielbasa tenderloin andouille leberkas tongue. Ribeye tri-tip tenderloin pig, chuck ground round chicken tongue corned beef biltong.
|
165
|
-
</div>
|
166
|
-
</div>
|
167
|
-
```
|
168
|
-
|
169
|
-
Use `.height-full` to set height to 100%.
|
170
|
-
|
171
|
-
```html
|
172
|
-
<div class="d-table border border-gray">
|
173
|
-
<div class="d-table-cell height-full v-align-middle pl-3">
|
174
|
-
<%= octicon "three-bars" %>
|
175
|
-
</div>
|
176
|
-
<div class="p-3">
|
177
|
-
Bacon ipsum dolor amet meatball flank beef tail pig boudin ham hock chicken capicola. Shoulder ham spare ribs turducken pork tongue. Bresaola corned beef sausage jowl ribeye kielbasa tenderloin andouille leberkas tongue. Ribeye tri-tip tenderloin pig, chuck ground round chicken tongue corned beef biltong.
|
178
|
-
</div>
|
179
|
-
</div>
|
180
|
-
```
|
181
|
-
|
182
|
-
## Position
|
183
|
-
Position utilities can be used to alter the default document flow. **Be careful when using positioning, it's often unnecessary and commonly misused.**
|
184
|
-
|
185
|
-
Use `.position-relative` to create a new stacking context.
|
186
|
-
|
187
|
-
_Note how the other elements are displayed as if "Two" were in its normal position and taking up space._
|
188
|
-
```html
|
189
|
-
<div class="d-inline-block float-left bg-blue text-white m-3" style="width:100px; height:100px;">
|
190
|
-
One
|
191
|
-
</div>
|
192
|
-
<div class="d-inline-block float-left position-relative bg-blue text-white m-3" style="width:100px; height:100px; top:12px; left:12px;">
|
193
|
-
Two
|
194
|
-
</div>
|
195
|
-
<div class="d-inline-block float-left bg-blue text-white m-3" style="width:100px; height:100px;">
|
196
|
-
Three
|
197
|
-
</div>
|
198
|
-
<div class="d-inline-block float-left bg-blue text-white m-3" style="width:100px; height:100px;">
|
199
|
-
Four
|
200
|
-
</div>
|
201
|
-
```
|
202
|
-
|
203
|
-
Use `.position-absolute` to take elements out of the normal document flow.
|
204
|
-
|
205
|
-
```html
|
206
|
-
<div class="position-relative" style="height:116px;">
|
207
|
-
<button type="button" class="btn btn-secondary mb-1">Button</button>
|
208
|
-
<div class="position-absolute border border-gray p-2">
|
209
|
-
<a href="#url" class="d-block p-1">Mashed potatoes</a>
|
210
|
-
<a href="#url" class="d-block p-1">Fries</a>
|
211
|
-
</div>
|
212
|
-
</div>
|
213
|
-
```
|
214
|
-
|
215
|
-
Use `.position-fixed` to position an element relative to the viewport. **Be careful when using fixed positioning. It is tricky to use and can lead to unwanted side effects.**
|
216
|
-
|
217
|
-
_Note: fixed positioning has been disabled here for demonstration only._
|
218
|
-
|
219
|
-
```html
|
220
|
-
<div class="position-fixed bg-gray-light border-bottom border-gray p-3">
|
221
|
-
.position-fixed
|
222
|
-
</div>
|
223
|
-
```
|
224
|
-
|
225
|
-
Use `top-0`, `right-0`, `bottom-0`, and `left-0` with `position-absolute`, `position-fixed`, or `position-relative` to further specify an elements position.
|
226
|
-
|
227
|
-
```html
|
228
|
-
<div style="height: 64px;">
|
229
|
-
<div class="border position-absolute top-0 left-0">
|
230
|
-
.top-0 .left-0
|
231
|
-
</div>
|
232
|
-
<div class="border position-absolute top-0 right-0">
|
233
|
-
.top-0 .right-0
|
234
|
-
</div>
|
235
|
-
<div class="border position-absolute bottom-0 right-0">
|
236
|
-
.bottom-0 .right-0
|
237
|
-
</div>
|
238
|
-
<div class="border position-absolute bottom-0 left-0">
|
239
|
-
.bottom-0 .left-0
|
240
|
-
</div>
|
241
|
-
</div>
|
242
|
-
```
|
243
|
-
|
244
|
-
To fill an entire width or height, use opposing directions.
|
245
|
-
|
246
|
-
_Note: fixed positioning has been disabled here for demonstration only._
|
247
|
-
|
248
|
-
```html
|
249
|
-
<div class="position-fixed left-0 right-0 p-3 bg-gray-dark text-white">
|
250
|
-
.position-fixed .left-0 .right-0
|
251
|
-
</div>
|
252
|
-
```
|
253
|
-
|
254
|
-
### Screen reader only
|
255
|
-
|
256
|
-
Use `.sr-only` to position an element outside of the viewport for screen reader access only. **Even though the element can't be seen, make sure it still has a sensible tab order.**
|
257
|
-
|
258
|
-
```html
|
259
|
-
<div class="js-details-container Details">
|
260
|
-
<button type="button" class="btn">Tab once from this button, and press enter</button>
|
261
|
-
<button type="button" class="sr-only js-details-target">
|
262
|
-
Screen reader only button
|
263
|
-
</button>
|
264
|
-
<div class="Details-content--hidden">
|
265
|
-
Button activated!
|
266
|
-
</div>
|
267
|
-
</div>
|
268
|
-
```
|
269
|
-
|
270
|
-
## The media object
|
271
|
-
|
272
|
-
Create a media object with utilities.
|
273
|
-
|
274
|
-
```html
|
275
|
-
<div class="clearfix p-3 border">
|
276
|
-
<div class="float-left p-3 mr-3 bg-gray">
|
277
|
-
Image
|
278
|
-
</div>
|
279
|
-
<div class="overflow-hidden">
|
280
|
-
<p><b>Body</b> Bacon ipsum dolor amet shankle rump tenderloin pork chop meatball strip steak bresaola doner sirloin capicola biltong shank pig. Alcatra frankfurter ham hock, ribeye prosciutto hamburger kevin brisket chuck burgdoggen short loin.</p>
|
281
|
-
</div>
|
282
|
-
</div>
|
283
|
-
```
|
284
|
-
Create a double-sided media object for a container with a flexible center.
|
285
|
-
|
286
|
-
```html
|
287
|
-
<div class="clearfix p-3 border border-gray">
|
288
|
-
<div class="float-left p-3 mr-3 bg-gray">
|
289
|
-
Image
|
290
|
-
</div>
|
291
|
-
<div class="float-right p-3 ml-3 bg-gray">
|
292
|
-
Image
|
293
|
-
</div>
|
294
|
-
<div class="overflow-hidden">
|
295
|
-
<p><b>Body</b> Bacon ipsum dolor amet shankle rump tenderloin pork chop meatball strip steak bresaola doner sirloin capicola biltong shank pig. Alcatra frankfurter ham hock, ribeye prosciutto hamburger kevin brisket chuck burgdoggen short loin.</p>
|
296
|
-
</div>
|
297
|
-
</div>
|
298
|
-
```
|
299
|
-
|
300
|
-
You can also create a media object with [flexbox utilities](./flexbox#media-object) instead of floats which can be useful for changing the vertical alignment.
|
@@ -1,126 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Margin
|
3
|
-
status: Stable
|
4
|
-
---
|
5
|
-
|
6
|
-
Margin utilities are based on a global [spacing scale](/styleguide/css/styles/core/support/spacing) which helps keep horizontal and vertical spacing consistent. These utilities help us reduce the amount of custom CSS that share the same properties, and allows to achieve many different page layouts using the same styles.
|
7
|
-
|
8
|
-
{:toc}
|
9
|
-
|
10
|
-
## Naming convention
|
11
|
-
|
12
|
-
Since margin utilities have many variations and will be used in many places, we use a shorthand naming convention to help keep class names succinct.
|
13
|
-
|
14
|
-
|
15
|
-
| Shorthand | Description |
|
16
|
-
| --- | --- |
|
17
|
-
| m | margin |
|
18
|
-
| t | top |
|
19
|
-
| r | right |
|
20
|
-
| b | bottom |
|
21
|
-
| l | left |
|
22
|
-
| x | horizontal, left & right |
|
23
|
-
| y | vertical, top & bottom |
|
24
|
-
| 0 | 0 |
|
25
|
-
| 1 | 4px |
|
26
|
-
| 2 | 8px |
|
27
|
-
| 3 | 16px |
|
28
|
-
| 4 | 24px |
|
29
|
-
| 5 | 32px |
|
30
|
-
| 6 | 40px |
|
31
|
-
|
32
|
-
_**Note:** The blue in the examples represents the element, and the orange represents the margin_
|
33
|
-
|
34
|
-
## Uniform margins
|
35
|
-
|
36
|
-
Use uniform spacing utilities to apply equal margin to all sides of an element. These utilities can change or override default margins, and can be used with a spacing scale from 0-6.
|
37
|
-
|
38
|
-
```html
|
39
|
-
<div class="margin-orange d-inline-block">
|
40
|
-
<div class="d-inline-block block-blue m-0">.m-0</div>
|
41
|
-
</div>
|
42
|
-
<div class="margin-orange d-inline-block">
|
43
|
-
<div class="d-inline-block block-blue m-1">.m-1</div>
|
44
|
-
</div>
|
45
|
-
<div class="margin-orange d-inline-block">
|
46
|
-
<div class="d-inline-block block-blue m-2">.m-2</div>
|
47
|
-
</div>
|
48
|
-
<div class="margin-orange d-inline-block">
|
49
|
-
<div class="d-inline-block block-blue m-3">.m-3</div>
|
50
|
-
</div>
|
51
|
-
<div class="margin-orange d-inline-block">
|
52
|
-
<div class="d-inline-block block-blue m-4">.m-4</div>
|
53
|
-
</div>
|
54
|
-
<div class="margin-orange d-inline-block">
|
55
|
-
<div class="d-inline-block block-blue m-5">.m-5</div>
|
56
|
-
</div>
|
57
|
-
<div class="margin-orange d-inline-block">
|
58
|
-
<div class="d-inline-block block-blue m-6">.m-6</div>
|
59
|
-
</div>
|
60
|
-
```
|
61
|
-
|
62
|
-
## Directional margins
|
63
|
-
|
64
|
-
Use directional utilities to apply margin to an individual side, or the X and Y axis of an element. Directional utilities can change or override default margins, and can be used with a spacing scale of 0-6.
|
65
|
-
|
66
|
-
```html
|
67
|
-
<div class="margin-orange d-inline-block">
|
68
|
-
<div class="d-inline-block block-blue mt-3">.mt-3</div>
|
69
|
-
</div>
|
70
|
-
<div class="margin-orange d-inline-block">
|
71
|
-
<div class="d-inline-block block-blue mr-3">.mr-3</div>
|
72
|
-
</div>
|
73
|
-
<div class="margin-orange d-inline-block">
|
74
|
-
<div class="d-inline-block block-blue mb-3">.mb-3</div>
|
75
|
-
</div>
|
76
|
-
<div class="margin-orange d-inline-block">
|
77
|
-
<div class="d-inline-block block-blue ml-3">.ml-3</div>
|
78
|
-
</div>
|
79
|
-
<div class="margin-orange d-inline-block">
|
80
|
-
<div class="d-inline-block block-blue my-3">.my-3</div>
|
81
|
-
</div>
|
82
|
-
<div class="margin-orange d-inline-block">
|
83
|
-
<div class="d-inline-block block-blue mx-3">.mx-3</div>
|
84
|
-
</div>
|
85
|
-
```
|
86
|
-
|
87
|
-
## Center elements
|
88
|
-
|
89
|
-
Use `mx-auto`to center block elements with a set width.
|
90
|
-
|
91
|
-
```html
|
92
|
-
<div class="margin-orange">
|
93
|
-
<div class="block-blue mx-auto text-center" style="width: 5rem;">.mx-auto</div>
|
94
|
-
</div>
|
95
|
-
```
|
96
|
-
|
97
|
-
## Reset margins
|
98
|
-
Reset margins built into typography elements or other components with `m-0`, `mt-0`, `mr-0`, `mb-0`, `ml-0`, `mx-0`, and `my-0`.
|
99
|
-
|
100
|
-
```html
|
101
|
-
<p class="mb-0 block-blue">No bottom margin on this paragraph.</p>
|
102
|
-
```
|
103
|
-
|
104
|
-
## Responsive margins
|
105
|
-
|
106
|
-
All margin utilities, except `mx-auto`, can be adjusted per [breakpoint](/styleguide/css/modules/grid#breakpoints) using the following formula: `m[direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up.
|
107
|
-
|
108
|
-
```html
|
109
|
-
<div class="d-inline-block margin-orange">
|
110
|
-
<div class="mx-sm-2 mx-lg-4 d-inline-block block-blue">
|
111
|
-
.mx-sm-2 .mx-lg-4
|
112
|
-
</div>
|
113
|
-
</div>
|
114
|
-
```
|
115
|
-
|
116
|
-
## Negative margins
|
117
|
-
|
118
|
-
You can add negative margins to the top, right, bottom, or left of an item by adding a negative margin utility. The formula for this is: `m[direction]-n[spacer]`. This also works responsively, with the following formula: `m[direction]-[breakpoint]-n[spacer]`.
|
119
|
-
|
120
|
-
```html
|
121
|
-
<div class="d-inline-block margin-orange p-3">
|
122
|
-
<div class="d-inline-block block-blue mt-n4 mr-lg-n4">
|
123
|
-
.mt-n4 .mr-lg-n6
|
124
|
-
</div>
|
125
|
-
</div>
|
126
|
-
```
|
@@ -1,110 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Padding
|
3
|
-
status: Stable
|
4
|
-
---
|
5
|
-
|
6
|
-
Padding utilities are based on a global [spacing scale](/styleguide/css/styles/core/support/spacing) which helps keep horizontal and vertical spacing consistent. These utilities help us reduce the amount of custom CSS that could share the same properties, and allows to achieve many different page layouts using the same styles.
|
7
|
-
|
8
|
-
{:toc}
|
9
|
-
|
10
|
-
## Shorthand
|
11
|
-
|
12
|
-
Since padding utilities have many variations and will be used in many places, we use a shorthand naming convention to help keep class names succinct.
|
13
|
-
|
14
|
-
| Shorthand | Description |
|
15
|
-
| --- | --- |
|
16
|
-
| p | padding |
|
17
|
-
| t | top |
|
18
|
-
| r | right |
|
19
|
-
| b | bottom |
|
20
|
-
| l | left |
|
21
|
-
| x | horizontal, left & right |
|
22
|
-
| y | vertical, top & bottom |
|
23
|
-
| 0 | 0 |
|
24
|
-
| 1 | 4px |
|
25
|
-
| 2 | 8px |
|
26
|
-
| 3 | 16px |
|
27
|
-
| 4 | 24px |
|
28
|
-
| 5 | 32px |
|
29
|
-
| 6 | 40px |
|
30
|
-
|
31
|
-
_**Note:** The blue in the examples below represents the element, and the green represents the padding._
|
32
|
-
|
33
|
-
## Uniform padding
|
34
|
-
|
35
|
-
Use uniform spacing utilities to apply equal padding to all sides of an element. These utilities can be used with a spacing scale from 0-6.
|
36
|
-
|
37
|
-
```html
|
38
|
-
<div class="padding-green d-inline-block p-0">
|
39
|
-
<div class="d-inline-block block-blue">.p-0</div>
|
40
|
-
</div>
|
41
|
-
<div class="padding-green d-inline-block p-1">
|
42
|
-
<div class="d-inline-block block-blue">.p-1</div>
|
43
|
-
</div>
|
44
|
-
<div class="padding-green d-inline-block p-2">
|
45
|
-
<div class="d-inline-block block-blue">.p-2</div>
|
46
|
-
</div>
|
47
|
-
<div class="padding-green d-inline-block p-3">
|
48
|
-
<div class="d-inline-block block-blue">.p-3</div>
|
49
|
-
</div>
|
50
|
-
<div class="padding-green d-inline-block p-4">
|
51
|
-
<div class="d-inline-block block-blue">.p-4</div>
|
52
|
-
</div>
|
53
|
-
<div class="padding-green d-inline-block p-5">
|
54
|
-
<div class="d-inline-block block-blue">.p-5</div>
|
55
|
-
</div>
|
56
|
-
<div class="padding-green d-inline-block p-6">
|
57
|
-
<div class="d-inline-block block-blue">.p-6</div>
|
58
|
-
</div>
|
59
|
-
```
|
60
|
-
|
61
|
-
## Directional padding
|
62
|
-
|
63
|
-
Use directional utilities to apply padding to an individual side, or the X and Y axis of an element. Directional utilities can change or override default padding, and can be used with a spacing scale of 0-6.
|
64
|
-
|
65
|
-
```html
|
66
|
-
<div class="padding-green d-inline-block pt-3">
|
67
|
-
<div class="d-inline-block block-blue">.pt-3</div>
|
68
|
-
</div>
|
69
|
-
<div class="padding-green d-inline-block pr-3">
|
70
|
-
<div class="d-inline-block block-blue">.pr-3</div>
|
71
|
-
</div>
|
72
|
-
<div class="padding-green d-inline-block pb-3">
|
73
|
-
<div class="d-inline-block block-blue">.pb-3</div>
|
74
|
-
</div>
|
75
|
-
<div class="padding-green d-inline-block pl-3">
|
76
|
-
<div class="d-inline-block block-blue">.pl-3</div>
|
77
|
-
</div>
|
78
|
-
<div class="padding-green d-inline-block py-3">
|
79
|
-
<div class="d-inline-block block-blue">.py-3</div>
|
80
|
-
</div>
|
81
|
-
<div class="padding-green d-inline-block px-3">
|
82
|
-
<div class="d-inline-block block-blue">.px-3</div>
|
83
|
-
</div>
|
84
|
-
```
|
85
|
-
|
86
|
-
## Responsive padding
|
87
|
-
|
88
|
-
All padding utilities can be adjusted per [breakpoint](/styleguide/css/styles/core/support/breakpoints) using the following formula: <br /> `p-[direction]-[breakpoint]-[spacer]`. Each responsive style is applied to the specified breakpoint and up.
|
89
|
-
|
90
|
-
```html
|
91
|
-
<div class="px-sm-2 px-lg-4 d-inline-block padding-green">
|
92
|
-
<div class="d-inline-block block-blue">
|
93
|
-
.px-sm-2 .px-lg-4
|
94
|
-
</div>
|
95
|
-
</div>
|
96
|
-
```
|
97
|
-
|
98
|
-
## Responsive container padding
|
99
|
-
|
100
|
-
`.p-responsive` is a padding class that adds padding on the left and right sides of an element. On small screens, it gives the element padding of `$spacer-3`, on mid-sized screens it gives the element padding of `$spacer-6`, and on large screens, it gives the element padding of `$spacer-3`.
|
101
|
-
|
102
|
-
It is intended to be used with [container styles](/styleguide/css/styles/core/objects/grid#containers)
|
103
|
-
|
104
|
-
```html
|
105
|
-
<div class="container-lg p-responsive">
|
106
|
-
<div class="border">
|
107
|
-
.container-lg .p-responsive
|
108
|
-
</div>
|
109
|
-
</div>
|
110
|
-
```
|