Is it possible to change img src attribute using css?

后端 未结 9 805
旧巷少年郎
旧巷少年郎 2021-01-07 23:20

I\'m trying to change img src (not the background img src) with css

\"btnUp\"/  

#btnUp{
    cursor:poi         


        
9条回答
  •  时光说笑
    2021-01-07 23:57

    You could set the image to a completely transparent image, then change the background image like so:

    img {
    background-image: url("img1.png");
    }
    //For example, if you hover over it.
    img:hover {
    background-image: url("img2.png");
    }
    

    The images do have to be the same size though. :( Hope this helps!

提交回复
热议问题