Is it possible to change img src attribute using css?

后端 未结 9 1040
旧巷少年郎
旧巷少年郎 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:44

    You can use CSS to a) make the original image invisible by setting its width and height to 0, or moving it off-screen etc, and b) insert a new image in its ::before or ::after pseudo-element.

    That will be a performance hit though, as the browser will then load both the original and the new image. But it won't require Javascript!

提交回复
热议问题