Is it possible to set the equivalent of a src attribute of an img tag in CSS?

后端 未结 25 2586
借酒劲吻你
借酒劲吻你 2020-11-22 09:30

Is it possible to set the src attribute value in CSS? At present, what I am doing is:


25条回答
  •  萌比男神i
    2020-11-22 10:09

    To reiterate a prior solution and to stress the pure CSS implementation here is my answer.

    A Pure CSS solution is needed in cases where you are sourcing content from another site, and thus you have no control over the HTML that is delivered. In my case I am trying to remove branding of licensed source content so that the licencee does not have to advertise for the company they are buying the content from. Therefore, I'm removing their logo while keeping everything else. I should note that this is within my client's contract to do so.

    { /* image size is 204x30 */
         width:0;
         height:0;
         padding-left:102px;
         padding-right:102px;
         padding-top:15px;
         padding-bottom:15px;
         background-image:url(http://sthstest/Style%20Library/StThomas/images/rhn_nav_logo2.gif);
    }
    

提交回复
热议问题