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

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

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


25条回答
  •  无人共我
    2020-11-22 10:11

    Use content:url("image.jpg").

    Full working solution (Live Demo):

    
    
    
    
    

    Tested and working:

    • Chrome 14.0.835.163
    • Safari 4.0.5
    • Opera 10.6

    Tested and Not working:

    • FireFox 40.0.2 (observing Developer Network Tools, you can see that the URL loads, but the image is not displayed)
    • Internet Explorer 11.0.9600.17905 (URL never loads)

提交回复
热议问题