Milligram: Feature request: vertical allign helper

Created on 7 Nov 2016  ·  4Comments  ·  Source: milligram/milligram

Since milligram's grid system based on flexboxes, is it hard to implement utility classes to align some stuff vertically? Please, it's 2k16!

help wanted

Most helpful comment

To vertically align, flexbox needs to have height: 100%; on the parent element. In this case, you have to set for html, body, .container and .row

html,
body,
.container,
.row {
  height: 100%;
}

Then the .row-center works.

All 4 comments

Hi @neronmoon
You're right, it's 2016! Milligram uses flexbox in the grids system. For vertical alignment use these classes:
.row-top, .row-bottom, .row-center, .row-stretch, .row-baseline.

Let me know if you still have any doubts about vertical alignment.

Hey @neronmoon For now I will close this Issue. Feel free to reopen if this doesn't do the trick for you.

@cjpatoilo what is the recommended way of using these?

I tried using this on your example grid, as shown below, but nothing centered.

<div class="row row-center">
  <div class="column column-10">
    <span class="column-demo">10%</span>
  </div>
</div>

On a related note, do you have a recommended way of centering the only thing in a row?

<div class="row">
  <button>Some Button Text</button>
</div>

For this, I've been using margin: 0 auto. But the one issue is that rows have negative margin, which means that everything is off to the left.

To vertically align, flexbox needs to have height: 100%; on the parent element. In this case, you have to set for html, body, .container and .row

html,
body,
.container,
.row {
  height: 100%;
}

Then the .row-center works.

Was this page helpful?
0 / 5 - 0 ratings