Tachyons: Aligning with auto margins

Created on 1 Jun 2017  ·  6Comments  ·  Source: tachyons-css/tachyons

Let me preface this issue card with a comment of recognition that the maintainers here are "hoping to have flex docs finished soon", and that they don't even know how they "feel about flex box being in core", and that v5 is perhaps underway.

Because of the remarks mentioned above, the topic of this issue is likely already known and is going to be addressed (I'm guessing in a non-core flexbox module). I just wanted to make sure it was explicitly posted somewhere.

I would like to request CSS class definitions for aligning flexbox items with margins. Something like

.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

This is no hack, and is in the overview of the spec as the method used to 'separate flex items into distinct "groups".' It even has its own chapter, “Aligning with auto margins”.

Of course, there are many other things that have been requested for flexbox on this repo, and I don't mean to simply add the noise. If you choose to not support Flexbox, that would be fine. As Feross said, this project should be what _you_ want it to be. I just thought I'd make sure it was noted as a fan desire, since it's a less known feature of aligning items with Flexbox.

enhancement v4

Most helpful comment

This seems useful - I'll add it to the next release.

All 6 comments

did you know that .center exists which is:

.center { 
  margin-left: auto;
  margin-right: auto; 
}

@blairanderson, right, but this couples the auto margins under the same class, so unfortunately it cannot be used for alignment of item groups within a flexbox container.

This seems useful - I'll add it to the next release.

And what about vertical margins ? Vertical centering with Flexbox is useful too ! Adding these would be coherent :

.mt-auto { margin-top: auto; }
.mb-auto { margin-bottom: auto; }

or
```css
.center-v {
margin-top: auto;
margin-bottom: auto;
}

Sorry for reviving this, but what about @FrankySnow suggestion ?

This seems useful - I'll add it to the next release.

I had to come to this issue to find out that .ml-auto and .mr-auto exist.
Would be great to add it to the spacing docs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FateRiddle picture FateRiddle  ·  3Comments

johno picture johno  ·  6Comments

mrmrs picture mrmrs  ·  9Comments

tabeth picture tabeth  ·  4Comments

johno picture johno  ·  3Comments