ionic 5“CSS自定义属性”--背景图像覆盖和重复

5ktev3wc  于 2022-12-08  发布在  Ionic
关注(0)|答案(2)|浏览(155)

i'm using ionic 5, i'm trying to cover the image background and make it not-repeat, so in ionic 5 i dont know if its possible
usualy i do like this:

background-image: url(assets/BGpaper-01.png);
background-repeat: no-repeat;
background-size: cover;

Using ionic they have custom css property for ionic components, for example:

ion-action-sheet, the background must be like this:

--background: url(assets/BGpaper-01.png);

for no-repeat and cover i try this:

ion-action-sheet {
--background: url(assets/BGpaper-01.png) no-repeat center center / cover;
}
  • but seems not work for me*
ngynwnxp

ngynwnxp1#

--background: url(../../../assets/images/bg.png) 0 0/100% 100% no-repeat;
bweufnob

bweufnob2#

background: url('../../../../assets/imgs/bg2.png') no-repeat center center fixed; 
        -webkit-background-size: cover;
        -moz-background-size: cover;
        background-size:cover;

相关问题