Is it possible to change img src attribute using css?

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

    There is another way to fix this : using CSS box-sizing.

    HTML :

    
    

    CSS :

    .banner {
      display: block;
      -moz-box-sizing: border-box;
      box-sizing: border-box;
      background: url(http://domain2.com/newbanner.png) no-repeat;
      width: 180px; /* Width of new image */
      height: 236px; /* Height of new image */
      padding-left: 180px; /* Equal to width of new image */
    }
    

    http://css-tricks.com/replace-the-image-in-an-img-with-css/

提交回复
热议问题