css transition opacity fade background

后端 未结 4 612
慢半拍i
慢半拍i 2020-12-09 08:21

I am doing a transition where it fades into transparent white, when a user is hovering an image.

My problem is that I need to change the color, that it

4条回答
  •  心在旅途
    2020-12-09 08:40

    It's not fading to "black transparent" or "white transparent". It's just showing whatever color is "behind" the image, which is not the image's background color - that color is completely hidden by the image.

    If you want to fade to black(ish), you'll need a black container around the image. Something like:

    .ctr {
        margin: 0; 
        padding: 0;
        background-color: black;
        display: inline-block;
    }
    

    and

提交回复
热议问题