The problem of overlapping coverage of css background Images

in the vue project, there are the following html:

 <div class="ware-image" :style=""background-image: url(" + ware.mainPic + ")""></div>
 <i class="sticker-image" :style=""background-image: url(" + ware.sticker + ")""></i>
 

css is:

 .ware-image
    display: inline-block
    width: 60px
    height 60px
    font-size: $font-size-medium
    background-size: contain
    background-repeat: no-repeat
    vertical-align: middle
    border: 1px solid $color-primary

.sticker-image
    position: absolute
    display: inline-block
    width: 20px
    height: 20px
    background-size: contain
    margin-left: (-@width)px

but the final effect is:

clipboard.png

the overlapping part of the picture shows the color of the first picture. It is useless for me to set z-index. How to solve it?

Css
Mar.03,2021

just add a background color. Css background image and background color properties are not mutually exclusive.


the image above is transparent. You will see the following in some hollowed-out places, but you can't see it if you set a background color for I. But your picture is not square, so there is a background color display on the edges and corners, and you need to add appropriate rounded corners.


icon with a background set to the desired color


you need to add a background-color; to the I tag

Menu