Skip to content

Commit

Permalink
Adding directional margin classes to the utilities (#1595)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jonrohan and langermank committed Sep 15, 2021
1 parent 4a1f09a commit 5fb831c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/sixty-masks-matter.md
@@ -0,0 +1,7 @@
---
"@primer/css": minor
---

Adding directional margin classes to the margin utilities.

Adding: `ml-auto, mb-auto, mr-auto`
14 changes: 14 additions & 0 deletions docs/content/utilities/margin.md
Expand Up @@ -91,6 +91,20 @@ Use `mx-auto`to center block elements with a set width.
</div>
```

We also provide directional margin auto. `mt-auto, mr-auto, mb-auto, ml-auto`

```html live
<div class="d-flex border mb-4">
<div style="height:100px;"></div>
<div class="border mt-auto">`mt-auto` will push this box to the bottom.</div>
<div class="border mb-auto">`mb-auto` will push this box to the top.</div>
</div>
<div class="d-flex flex-column border">
<div class="border ml-auto">`ml-auto` will push this box to the right.</div>
<div class="border mr-auto">`mr-auto` will push this box to the left.</div>
</div>
```

## Reset margins
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`.

Expand Down
3 changes: 3 additions & 0 deletions src/utilities/margin.scss
Expand Up @@ -63,3 +63,6 @@
.m-auto { margin: auto !important; }

.mt-auto { margin-top: auto !important; }
.mr-auto { margin-right: auto !important; }
.mb-auto { margin-bottom: auto !important; }
.ml-auto { margin-left: auto !important; }

0 comments on commit 5fb831c

Please sign in to comment.