Search code examples
htmlcssionic-frameworkionic4

Ionic 4 - How to change modal background to transparent?


I am trying to create a modal with transparent background but it is not working

ion-content {
  --background-color: rgba(255, 255, 255, 0.7);
}

.closeBtn {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0px;
}
<ion-content padding>
  <h3 class="ion-text-center">
    <strong>Test.</strong>
  </h3>
  <ion-button class="closeBtn" color='light' fill='clear'>Close</ion-button>
</ion-content>

I expect to see some transparency.


Solution

  • global.css

    .modal-wrapper{
        background: transparent !important;
    }
    

    page.scss

    ion-content{
        --background: transparent;
    }