# How to get Logo and Title centered?

**URL:** <https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703>\
**Category:** Ionic Framework\
**Created:** [November 15, 2018, 10:30pm UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703 "2018-11-15T22:30:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laire](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@Laire](https://forum.ionicframework.com/u/Laire)\
**Post date:** [November 15, 2018, 10:30pm UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/1 "2018-11-15T22:30:09Z")

</div>

Hello,

I want to add a logo to the header bar, but I don’t get the text vertical centered when I add a image:

![Unbenannt](https://global.discourse-cdn.com/ionicframework/original/3X/e/6/e66fe4488c43902be86561e452482ed9d4b2dc53.png)

My Code:

```auto
<ion-header>
  <ion-toolbar>
    <ion-title>
        <img alt="logo" id="header_logo" height="40" float-left src="assets/images/logo_40.png"> NotSan Hessen
    </ion-title>
  </ion-toolbar>
</ion-header>

```

---

<div class="post-metadata">

**Author:** ![nirav\_ionic](https://avatars.discourse-cdn.com/v4/letter/n/b782af/32.png) [@nirav\_ionic](https://forum.ionicframework.com/u/nirav_ionic)\
**Post date:** [November 16, 2018, 6:17am UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/2 "2018-11-16T06:17:54Z")

</div>

> <https://stackoverflow.com/questions/47362813/center-align-ion-title>

---

<div class="post-metadata">

**Author:** ![MaBbKhawaja](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mabbkhawaja/32/120141_2.png) [@MaBbKhawaja](https://forum.ionicframework.com/u/MaBbKhawaja)\
**Post date:** [November 16, 2018, 6:46am UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/3 "2018-11-16T06:46:41Z")

</div>

```auto
<ion-header>
  <ion-navbar>
    <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>Search Results</ion-title>
  </ion-navbar>
</ion-header>

```

here is a demo of my code its working fine just change ion icon with your picture

---

<div class="post-metadata">

**Author:** ![Laire](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@Laire](https://forum.ionicframework.com/u/Laire)\
**Post date:** [November 17, 2018, 10:52pm UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/4 "2018-11-17T22:52:48Z")

</div>

@MaBbKhawaja  
Seems like that doesn’t work with images:

![Unbenannt](https://global.discourse-cdn.com/ionicframework/original/3X/9/d/9def07137b036bda33d92b6246c579ff1dd63664.png)

```auto
<ion-header>
  <ion-toolbar>
    <button ion-button>
        <img alt="logo" id="header_logo" height="40" src="assets/images/logo_40.png">
    </button>
    <ion-title>
          NotSan Hessen
    </ion-title>
  </ion-toolbar>
</ion-header>

```

---

<div class="post-metadata">

**Author:** ![Laire](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@Laire](https://forum.ionicframework.com/u/Laire)\
**Post date:** [November 17, 2018, 10:55pm UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/5 "2018-11-17T22:55:02Z")

</div>

@nirav_ionic  
Vertical center, not horizontal

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [November 18, 2018, 12:31am UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/6 "2018-11-18T00:31:17Z")

</div>

This isn’t Ionic-specific, but I have a generic CSS class I use for this sort of thing, which should work for you:

```auto
.hcs {
  display: flex;
  flex-direction: row;
  align-items: center;
}

```

```auto
<ion-header>
<ion-toolbar>
<ion-title>
<div class="hcs">
<img src="assets/images/logo.png">
<span>NotSan Hessen</span>
</div>
</ion-title>
</ion-toolbar>
</ion-header>

```

---

<div class="post-metadata">

**Author:** ![MaBbKhawaja](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mabbkhawaja/32/120141_2.png) [@MaBbKhawaja](https://forum.ionicframework.com/u/MaBbKhawaja)\
**Post date:** [November 18, 2018, 9:23am UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/7 "2018-11-18T09:23:53Z")

</div>

```auto
<ion-icon><img alt="logo" id="header_logo" height="40" src="assets/images/logo_40.png"></ion-icon> 

```

try this

---

<div class="post-metadata">

**Author:** ![nirman99](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@nirman99](https://forum.ionicframework.com/u/nirman99)\
**Post date:** [November 19, 2018, 2:53pm UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/8 "2018-11-19T14:53:32Z")

</div>

Use CSS flex. I use them always whenever something has to be centered.

---

<div class="post-metadata">

**Author:** ![Laire](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@Laire](https://forum.ionicframework.com/u/Laire)\
**Post date:** [November 19, 2018, 5:47pm UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/9 "2018-11-19T17:47:38Z")

</div>

My solution, but only tested in my browser:

```auto
<ion-header>
  <ion-toolbar>
    <ion-title>
        Notsan Hessen
    </ion-title>
  </ion-toolbar>
</ion-header>

```

```auto
ion-title {
    line-height: 40px;
    padding-left: 50px;
    background: url('../../assets/images/logo_40.png') no-repeat left center;
}

```

![Unbenannt](https://global.discourse-cdn.com/ionicframework/original/3X/8/3/83665a3efbde7411cb247298c3f80bcf2f691331.png)

---

<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:09pm UTC](https://forum.ionicframework.com/t/how-to-get-logo-and-title-centered/147703/10 "2021-07-19T21:09:29Z")

</div>

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


