# Customize Ionic 4 toast css \[position, text-position\]

**URL:** <https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681>\
**Category:** ionic-v3\
**Created:** [March 10, 2019, 3:52am UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681 "2019-03-10T03:52:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joabchua](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joabchua](https://forum.ionicframework.com/u/joabchua)\
**Post date:** [March 10, 2019, 3:52am UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681/1 "2019-03-10T03:52:24Z")

</div>

Hi All,  
I am using ionic 4. My application has tabs at the bottom. I am using toast at the bottom of my page whenever an operation is completed. I would like to find out how I can shift the toast slightly higher so that my tabs component will not be partially covered by the toast at the bottom when an operation is completed.

Current limitation now:

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/2/c/2c332ee4c27ee8496fac097a61bc47804fcf56f1.png)

Hope to achieve this.

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/6/b/6b503e74af426c452fa13d8eb5eb8fbaf9114073.png)

Please advise and also if there is any option to center the text msg in the toast would be perfect. Thank you.

---

<div class="post-metadata">

**Author:** ![joabchua](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joabchua](https://forum.ionicframework.com/u/joabchua)\
**Post date:** [March 17, 2019, 2:43pm UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681/2 "2019-03-17T14:43:13Z")

</div>

Alright. Got my own hack around it. Finally. I wish Ionic toast can have a property to define its custom position.

---

<div class="post-metadata">

**Author:** ![IonicGeoff](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ionicgeoff/32/128657_2.png) [@IonicGeoff](https://forum.ionicframework.com/u/IonicGeoff)\
**Post date:** [March 18, 2019, 4:30am UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681/3 "2019-03-18T04:30:09Z")

</div>

If you use a custom animation you can set css properties for the toast, including text alignment, and you have to set the vertical position because it defaults to “top”…See the .beforeStyles property below…

```auto
  //----------------------------------------------------------------------------------------------//  
  export function toastEnter(AnimationC: Animation, baseEl: HTMLElement, opts?: any) {
    const baseAnimation = new AnimationC();

    console.log(baseEl.lastChild);

    const wrapperAnimation = new AnimationC();
    wrapperAnimation.addElement(baseEl.querySelector('.toast-wrapper'));
    wrapperAnimation
      .fromTo('opacity', '0', '1')
      .fromTo('transform', 'scale3d(1.5,1.5,1.5) rotate(90deg)', 'scale3d(1,1,1) rotate(0deg)')
      .beforeStyles({ 'text-align': 'center', 'top': '20%' })
      ;

    return Promise.resolve(baseAnimation
      .addElement(baseEl)
      .easing('ease')
      .add(wrapperAnimation)
      .duration(600)
    );
  }

  //----------------------------------------------------------------------------------------------//  

```

---

<div class="post-metadata">

**Author:** ![IonicGeoff](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ionicgeoff/32/128657_2.png) [@IonicGeoff](https://forum.ionicframework.com/u/IonicGeoff)\
**Post date:** [March 18, 2019, 4:42am UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681/4 "2019-03-18T04:42:28Z")

</div>

Here is it in action…

[Toast with animation, text centered, 20% from top](https://www.screencast.com/t/uXuXjEeAs70)

---

<div class="post-metadata">

**Author:** ![joabchua](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joabchua](https://forum.ionicframework.com/u/joabchua)\
**Post date:** [March 19, 2019, 7:33am UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681/5 "2019-03-19T07:33:51Z")

</div>

Looks good. Hey @IonicGeoff how do u add ur custom function into ur application? Do u just add it as a custom ts and import it into ur page or ?

---

<div class="post-metadata">

**Author:** ![IonicGeoff](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ionicgeoff/32/128657_2.png) [@IonicGeoff](https://forum.ionicframework.com/u/IonicGeoff)\
**Post date:** [March 19, 2019, 8:02am UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681/6 "2019-03-19T08:02:03Z")

</div>

Just follow these instructions, that Joshua Morony wrote for a modal window. The same technique can be used for any window (Toast, Alert etc) which has an animation method available.

> **[Create a Custom Modal Page Transition Animation in Ionic](https://www.joshmorony.com/create-a-custom-modal-page-transition-animation-in-ionic/)**
>
> In this tutorial, we walk through how to create a custom page transition animation for modals in Ionic.

---

<div class="post-metadata">

**Author:** ![joabchua](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@joabchua](https://forum.ionicframework.com/u/joabchua)\
**Post date:** [March 19, 2019, 9:06am UTC](https://forum.ionicframework.com/t/customize-ionic-4-toast-css-position-text-position/158681/7 "2019-03-19T09:06:18Z")

</div>

wow! Got it working with the method that u suggested. Thanks so much man! Appreciate it.
