# Ionic 4 Pop over styling

**URL:** <https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997>\
**Category:** Ionic Framework\
**Created:** [February 20, 2019, 6:31pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997 "2019-02-20T18:31:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rotor7ven](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@Rotor7ven](https://forum.ionicframework.com/u/Rotor7ven)\
**Post date:** [February 20, 2019, 6:31pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/1 "2019-02-20T18:31:01Z")

</div>

Hello everyone, I’m trying to stylize my popover with the cssClass property as stated in the docs but it does not seem to be working. By default the width of the popover content is 170px but I need it to over the width of the device. How can i achieve this? I looked at other post but they seem to be in ionic 3 and not working.

Home.ts:

```auto
async openPopOver(ev: Event) {
    const popover = await this.popoverCtrl.create({
      component: PopOverPage,
      event: ev,
      cssClass: 'pop-over-style'
    });
    popover.present();
  }

```

home.css

```auto
.pop-over-style {
    .popover-content {
        //width: 80% !important; - this wont work or the bottom one.
        --width: 300px !important;
    }
}

```

---

<div class="post-metadata">

**Author:** ![tokuhara](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tokuhara](https://forum.ionicframework.com/u/tokuhara)\
**Post date:** [February 20, 2019, 6:58pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/2 "2019-02-20T18:58:46Z")

</div>

These are the ionic 4 docs - [https://ionicframework.com/docs/api/popover#css-custom-properties](https://ionicframework.com/docs/api/popover#css-custom-properties)  
You can use --min-width for popover width.

---

<div class="post-metadata">

**Author:** ![Rotor7ven](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@Rotor7ven](https://forum.ionicframework.com/u/Rotor7ven)\
**Post date:** [February 20, 2019, 7:00pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/3 "2019-02-20T19:00:16Z")

</div>

thank you for your response. I have tried what you suggested but it does not work.

```auto
.pop-over-style .popover-content {
    --min-width: 300px !important;
}

```

---

<div class="post-metadata">

**Author:** ![tokuhara](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tokuhara](https://forum.ionicframework.com/u/tokuhara)\
**Post date:** [February 20, 2019, 7:07pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/4 "2019-02-20T19:07:47Z")

</div>

Try to put the css into the ionic global css file.

---

<div class="post-metadata">

**Author:** ![Rotor7ven](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@Rotor7ven](https://forum.ionicframework.com/u/Rotor7ven)\
**Post date:** [February 20, 2019, 7:23pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/5 "2019-02-20T19:23:40Z")

</div>

Works! Thank you sir!

---

<div class="post-metadata">

**Author:** ![tokuhara](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tokuhara](https://forum.ionicframework.com/u/tokuhara)\
**Post date:** [February 20, 2019, 7:29pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/6 "2019-02-20T19:29:11Z")

</div>

Congrats, glad it worked!

---

<div class="post-metadata">

**Author:** ![reedglawrence](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@reedglawrence](https://forum.ionicframework.com/u/reedglawrence)\
**Post date:** [August 20, 2019, 7:21pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/7 "2019-08-20T19:21:46Z")

</div>

I also had this issue and cannot reliably get the style to apply via classes in the `global.scss` file. I found that this code works for limited purposes:

```auto
  async presentCustomPopover() {
    const popover = await this.popoverController.create({
      component: CustomPopoverPage
    });

    popover.style.cssText = '--min-width: 250px; --max-width: 270px;';
    return popover.present();
  }

```

---

<div class="post-metadata">

**Author:** ![supraja](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@supraja](https://forum.ionicframework.com/u/supraja)\
**Post date:** [December 12, 2019, 6:47am UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/8 "2019-12-12T06:47:05Z")

</div>

Thanks you it worked for me also.

---

<div class="post-metadata">

**Author:** ![hamcker](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hamcker/32/137078_2.png) [@hamcker](https://forum.ionicframework.com/u/hamcker)\
**Post date:** [April 8, 2021, 7:17pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/9 "2021-04-08T19:17:31Z")

</div>

the question is WHERE?

I set it globally like this:

```auto
ion-content {
   --min-with: 80vw;
}

```

still not working

---

<div class="post-metadata">

**Author:** ![tokuhara](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tokuhara](https://forum.ionicframework.com/u/tokuhara)\
**Post date:** [April 8, 2021, 9:47pm UTC](https://forum.ionicframework.com/t/ionic-4-pop-over-styling/156997/10 "2021-04-08T21:47:23Z")

</div>

If you want to set the ion-content width you can use something like this in global.css

```auto
ion-content {
  --min-width: 80vw !important;
  min-width: 80vw !important;
}

```
