Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 3 ion-title cannot align center

Tags:

ionic4

I use Ionic 3, below the code cannot align the title to center, it moves a little bit right due to the ion-buttons. How can it be solved?

<ion-header>
  <ion-toolbar color="primary">
    <ion-buttons slot="start">
      <ion-button (click)="close()">
        <ion-icon name="arrow-back"></ion-icon>
      </ion-button>
    </ion-buttons>
    <ion-title text-center>{{bookName}}</ion-title>
</ion-toolbar>
</ion-header>
like image 424
Pardeep Avatar asked Sep 21 '18 14:09

Pardeep


Video Answer


2 Answers

just add mode=ios at title like this

<ion-title mode=ios>Your Title</ion-title>

Tested in ionic 3, 4 and 5 both

like image 121
Jain Bhavesh Avatar answered Sep 17 '22 21:09

Jain Bhavesh


You could try to wrap your title in a div like this:

<div text-center>
    <ion-title>YOUR TITLE</ion-title>
</div>
like image 32
Rob Avatar answered Sep 18 '22 21:09

Rob