Skip to content

Commit 5fb831c

Browse files
jonrohanlangermank
andauthored
Adding directional margin classes to the utilities (#1595)
* Adding directional margin classes to the utilities Co-Authored-By: Katie Langerman <langermank@gmail.com> * Create sixty-masks-matter.md * Pushes the box to the top Co-authored-by: Katie Langerman <langermank@gmail.com>
1 parent 4a1f09a commit 5fb831c

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.changeset/sixty-masks-matter.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@primer/css": minor
3+
---
4+
5+
Adding directional margin classes to the margin utilities.
6+
7+
Adding: `ml-auto, mb-auto, mr-auto`

docs/content/utilities/margin.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ Use `mx-auto`to center block elements with a set width.
9191
</div>
9292
```
9393

94+
We also provide directional margin auto. `mt-auto, mr-auto, mb-auto, ml-auto`
95+
96+
```html live
97+
<div class="d-flex border mb-4">
98+
<div style="height:100px;"></div>
99+
<div class="border mt-auto">`mt-auto` will push this box to the bottom.</div>
100+
<div class="border mb-auto">`mb-auto` will push this box to the top.</div>
101+
</div>
102+
<div class="d-flex flex-column border">
103+
<div class="border ml-auto">`ml-auto` will push this box to the right.</div>
104+
<div class="border mr-auto">`mr-auto` will push this box to the left.</div>
105+
</div>
106+
```
107+
94108
## Reset margins
95109
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`.
96110

src/utilities/margin.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,6 @@
6363
.m-auto { margin: auto !important; }
6464

6565
.mt-auto { margin-top: auto !important; }
66+
.mr-auto { margin-right: auto !important; }
67+
.mb-auto { margin-bottom: auto !important; }
68+
.ml-auto { margin-left: auto !important; }

0 commit comments

Comments
 (0)