Ionic 3 - I want a modal screen not full size

Murilo picture Murilo · Mar 9, 2018 · Viewed 7.1k times · Source

I need a modal page with no full size (80% width, <60% height, centered) to select some items, like an alert control. How to implement the CSS for this case?

Answer

Swapnil Patwa picture Swapnil Patwa · Mar 9, 2018

Initialize modal with cssClass

 let modal = this.modalCtrl.create(CustomSelectPage, {data: data}, {cssClass: 'select-modal' });

Then add CSS to the class in app.scss

.select-modal {
   background: rgba(0, 0, 0, 0.5) !important;
   padding: 20% 10%  !important;
}

Change the numbers according to your design.