Skip to content

Commit 1a9c1bb

Browse files
committed
move em-spacers below spacers and update with new variables
1 parent d475d35 commit 1a9c1bb

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

modules/primer-support/docs/spacing.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,6 @@ The spacing scale is used for [margin](./utilities/margin) and [padding](./utili
2323

2424
See [primer-marketing-support](../primer-marketing-support) for the extended spacing scale used for marketing needs and the related y-axis spacing utilities for [margin](../primer-marketing-utilities/docs/margin.md) and [padding](../primer-marketing-utilities/docs/padding.md).
2525

26-
## Em-based spacing
27-
Ems are used for spacing within components such as buttons and form elements. We stick to common fractions for em values so that, in combination with typography and line-height, the total height lands on sensible numbers.
28-
29-
We aim for whole numbers, however, GitHub's body font-size is 14px which is difficult to work with, so we sometimes can't achieve a whole number. Less desirable values are highlighted in <span class="text-red">red</span> below.
30-
31-
| Fraction | Y Padding (em) | Total height at 14px | Total height at 16px |
32-
| --- | --- | --- | --- |
33-
| 3/4 | .75 | 42 | 48 |
34-
| 1/2 | .5 | 35 | 40 |
35-
| 3/8 | .375 | <span class="text-red">31.5</span> | 36 |
36-
| 1/4 | .25 | 28 | 32 |
37-
| 1/8 | .125 | <span class="text-red">24.5</span> | 28 |
38-
39-
We recommend using the fractions shown above. To calculate values with other font-sizes or em values, we suggest using [Formula](http://jxnblk.com/formula/).
40-
4126
## Spacer Variables
4227

4328
These variables match the above scale and are encouraged to be used within components. They are also used in our [margin](./utilities/margin) and [padding utilities](./utilities/padding).
@@ -50,3 +35,19 @@ $spacer-4: 24px;
5035
$spacer-5: 32px;
5136
$spacer-6: 40px;
5237
```
38+
39+
## Em-based spacing
40+
Ems are used for spacing within components such as buttons and form elements. We stick to common fractions for em values so that, in combination with typography and line-height, the total height lands on sensible numbers.
41+
42+
We aim for whole numbers, however, GitHub's body font-size is 14px which is difficult to work with, so we sometimes can't achieve a whole number. Less desirable values are highlighted in <span class="text-red">red</span> below.
43+
44+
| Fraction | Y Padding (em) | Total height at 14px | Total height at 16px |
45+
| --- | --- | --- | --- |
46+
| $em-spacer-1 | 1/16 | .0625 | <span class="text-red">22.75</span> | 26 |
47+
| $em-spacer-2 | 1/8 | .125 | <span class="text-red">24.5</span> | 28 |
48+
| $em-spacer-3 | 1/4 | .25 | 28 | 32 |
49+
| $em-spacer-4 | 3/8 | .375 | <span class="text-red">31.5</span> | 36 |
50+
| $em-spacer-5 | 1/2 | .5 | 35 | 40 |
51+
| $em-spacer-6 | 3/4 | .75 | 42 | 48 |
52+
53+
We recommend using the fractions shown above. To calculate values with other font-sizes or em values, we suggest using [Formula](http://jxnblk.com/formula/).

0 commit comments

Comments
 (0)