is there a way to do this other than adding empty elements above the button? I know ionic is using flexbox but I’m not sure what I have to do to the button to achieve the desired effect.
How does this work for you? Flex bow will let you do this like this but you have to apply it right to the content area.
This is a great GUI way to mess with flex properties and see the css is generates. Plus it will generate prefixed css http://the-echoplex.net/flexyboxes/
@mhartington so to clarify how this works. The <ion-content> tag is given the .scroll-content class by the ionic framework (I’m not seeing that in the markup so I’m assuming). And all the flexbox stuff of that class is centering the inner elements, row etc.
I use your snippet to vertically center my content and it works pretty well. The only issue I have is that I can’t find a way to keep the original width of my elements, all of them seems to have a “width:auto” or something similar.
How can I have my elements to be like width:100% of the screen ?
Thanks again for this snippet !
I realize this post is a bit old, but I was just looking at this and in order to keep the items stretched to be with a 100% width. Here is an alternative:
It was working well until I updated to Ionic 1.2.4
When using that version on Android devices the content (on the example is the button) is no longer centered but instead appears on top. On IOS it’s still centered.
Do you know if there is some additional change that can be made to make it work again on Android?