不透明度不适用于 Ionic 3

Opacity does not working on Ionic 3

如何只在背景图像中放置深色不透明度?下面是CSS代码

.loginPage{
   background:url('../../assets/icon/backgroundlogin') no-repeat center;
   background-size:cover;
   background-color:rgba(0,0,0,.5);
}

这里是我的 html 代码

<ion-content padding class="loginPage">
// Here is my content
</ion-content>

您需要使用 multiple backgrounds,使用逗号 , 类似于:

background: linear-gradient( rgba(0, 0, 0,.5), rgba(0, 0, 0, .5)), url('../../assets/icon/backgroundlogin') no-repeat center

这是一个基本示例:

body {
  background: linear-gradient(rgba(0, 0, 0,.5), rgba(0, 0, 0, .5)), url(https://i.stack.imgur.com/FEEPy.jpg) no-repeat center / cover
}