# Horizontally align title on Navbar on Android

**URL:** <https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142>\
**Category:** ionic-v3\
**Created:** [April 6, 2018, 3:54pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142 "2018-04-06T15:54:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fieel](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fieel/32/118047_2.png) [@Fieel](https://forum.ionicframework.com/u/Fieel)\
**Post date:** [April 6, 2018, 3:54pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/1 "2018-04-06T15:54:25Z")

</div>

Hi all!

Lately i’ve been struggling to fix a small problem with the title in my navbar. Basically, the title in my navar are slightly misplaced on the right and not centered, this happens only on Android.

Also this happens only when a sidemenu button is present, otherwise the title is centered correctly.

Here’s the code:

```auto
<ion-header>
    <ion-navbar>
        <button ion-button menuToggle left >
            <ion-icon name="menu"></ion-icon>
        </button>
        <ion-title text-center>{{ titolo }}</ion-title>
    </ion-navbar>
</ion-header>

```

Here’s a screenshot of the problem:  
 ![Capture](https://global.discourse-cdn.com/ionicframework/original/3X/3/2/3263620c6067a055be4b37bc9dcf0cd6f9b79fcf.JPG)

---

<div class="post-metadata">

**Author:** ![ChrisGriiffith](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/chrisgriiffith/32/66576_2.png) [@ChrisGriiffith](https://forum.ionicframework.com/u/ChrisGriiffith)\
**Post date:** [April 6, 2018, 5:34pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/2 "2018-04-06T17:34:09Z")

</div>

Have you used Chrome’s dev tools to inspect the DOM and CSS to see what is introducing this?

You might have some custom CSS in your design that is being applied to the title.

---

<div class="post-metadata">

**Author:** ![Fieel](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fieel/32/118047_2.png) [@Fieel](https://forum.ionicframework.com/u/Fieel)\
**Post date:** [April 6, 2018, 6:12pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/3 "2018-04-06T18:12:22Z")

</div>

The main reason is that i have the toggleMenu button on the left side of the navbar. I thought Ionic fixed this automatically when using the “text-center” property in the view. (iOS does indeed).

![test2](https://global.discourse-cdn.com/ionicframework/original/3X/7/0/7067741dc584e7804b131b407e8993e42bbb1819.gif)

Before trying to fix the problem with weird workarounds i’d like to know what’s the proper way to deal with this or if this is simply a bug.

---

<div class="post-metadata">

**Author:** ![robinyo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robinyo/32/115964_2.png) [@robinyo](https://forum.ionicframework.com/u/robinyo)\
**Post date:** [April 6, 2018, 9:56pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/4 "2018-04-06T21:56:08Z")

</div>

How does it look when you preview all three supported Mobile platforms side by side:

`ionic serve --lab`

For example:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/a/9/a97f5f1c7c7ebeb6e95231e108ea1b4e9682fe49.jpg)

See: [https://github.com/Robinyo/big-top/blob/master/src/pages/events/events.html](https://github.com/Robinyo/big-top/blob/master/src/pages/events/events.html)

---

<div class="post-metadata">

**Author:** ![Fieel](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fieel/32/118047_2.png) [@Fieel](https://forum.ionicframework.com/u/Fieel)\
**Post date:** [April 6, 2018, 11:31pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/5 "2018-04-06T23:31:35Z")

</div>

It looks okay on ios but slightly offset to the right on android

 ![Capture](https://global.discourse-cdn.com/ionicframework/original/3X/0/0/00a8579fae53beca5c058a8f9ec895eb8cb246f4.JPG)

---

<div class="post-metadata">

**Author:** ![robinyo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robinyo/32/115964_2.png) [@robinyo](https://forum.ionicframework.com/u/robinyo)\
**Post date:** [April 6, 2018, 11:37pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/6 "2018-04-06T23:37:48Z")

</div>

Try it without the `text-center` attribute.

---

<div class="post-metadata">

**Author:** ![Fieel](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fieel/32/118047_2.png) [@Fieel](https://forum.ionicframework.com/u/Fieel)\
**Post date:** [April 7, 2018, 11:13am UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/7 "2018-04-07T11:13:34Z")

</div>

> [@robinyo](#):
>
> Try it without the text-center attribute.

I already tried all kind of similar solutions before opening this thread. Here’s a screenshot without the text-center attribute…

 ![Capture](https://global.discourse-cdn.com/ionicframework/original/3X/2/2/22808f72c453357954c819cc6c0605d7f7b38228.JPG)

the title isn’t centered anymore.

---

<div class="post-metadata">

**Author:** ![robinyo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robinyo/32/115964_2.png) [@robinyo](https://forum.ionicframework.com/u/robinyo)\
**Post date:** [April 7, 2018, 11:39am UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/8 "2018-04-07T11:39:10Z")

</div>

> [@robinyo](#):
>
> Try it without the text-center attribute.

My point being what’s is the default behaviour on each platform?

- on iOS the title is centred
- on Android the title is not centred (its left-ish aligned)
- on Windows the title is not centred (its left-ish aligned)

 ![47](https://global.discourse-cdn.com/ionicframework/original/3X/1/0/1062e0a439057bbb38a756b775f5ab76751c709d.jpg)

---

<div class="post-metadata">

**Author:** ![robinyo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robinyo/32/115964_2.png) [@robinyo](https://forum.ionicframework.com/u/robinyo)\
**Post date:** [April 7, 2018, 11:51am UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/9 "2018-04-07T11:51:06Z")

</div>

```auto
<ion-header>
    <ion-navbar>
        <button ion-button menuToggle left >
            <ion-icon name="menu"></ion-icon>
        </button>
        <ion-title text-center>{{ titolo }}</ion-title>
    </ion-navbar>
</ion-header>

```

OK, I see what you mean.

The ion-title text is being centred within the it’s parent, the navbar.

However, the centring doesn’t take into account the side menu.

---

<div class="post-metadata">

**Author:** ![Fieel](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/fieel/32/118047_2.png) [@Fieel](https://forum.ionicframework.com/u/Fieel)\
**Post date:** [April 7, 2018, 12:08pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/10 "2018-04-07T12:08:13Z")

</div>

Exactly. Is there an easy fix to have an always-properly centered title on android?

---

<div class="post-metadata">

**Author:** ![robinyo](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/robinyo/32/115964_2.png) [@robinyo](https://forum.ionicframework.com/u/robinyo)\
**Post date:** [April 7, 2018, 7:57pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/11 "2018-04-07T19:57:08Z")

</div>

See:

- [https://stackoverflow.com/questions/30005284/ionic-nav-bar-title-is-not-centered-on-android-device/42299612](https://stackoverflow.com/questions/30005284/ionic-nav-bar-title-is-not-centered-on-android-device/42299612)
- [Navbar ion-title align center for android](https://forum.ionicframework.com/t/navbar-ion-title-align-center-for-android/52263)

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:41pm UTC](https://forum.ionicframework.com/t/horizontally-align-title-on-navbar-on-android/127142/12 "2021-07-19T21:41:28Z")

</div>

Closed on July 19, 2021, 9:41pm UTC


