A solution at http://codepen.io/mhartington/pen/tAeJg works with the ‘ion-content’ directive. But it does not work if I use it with the ‘ion-view’ directive.
My code looks like this:
<ion-view title="Home" >
<ion-nav-buttons side="left">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>
<ion-content class="has-header" class="center">
<h1>Centered Content - Hello World</h1>
</ion-content></ionview>
CSS is:
.center {
border: 1px solid red;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-flex-wrap: nowrap;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-pack: center;
-moz-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-align-content: stretch;
-ms-flex-line-pack: stretch;
align-content: stretch;
-webkit-box-align: center;
-moz-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;}
The CSS above works well when it is used with ion-content directive and NO ion-view. But, when the above CSS is used with the ‘ion-view’ and ‘ion-content’ directives like the code above, it does not center the content. Why?
What is the solution to center the content under the ion-view directive?