Can I use an image from my local file system as background in HTML?

后端 未结 5 1889
粉色の甜心
粉色の甜心 2020-12-05 09:12

I\'ve got an HTML document hosted on a remote web server. I\'m trying to have one of the elements on the web page use an image file from my local file system as its backgrou

5条回答
  •  情歌与酒
    2020-12-05 10:00

    Jeff Bridgman is correct. All you need is
    background: url('pic.jpg')
    and this assumes that pic is in the same folder as your html.

    Also, Roberto's answer works fine. Tested in Firefox, and IE. Thanks to Raptor for adding formatting that displays full picture fit to screen, and without scrollbars... In a folder f, on the desktop is this html and a picture, pic.jpg, using your userid. Make those substitutions in the below:

    
    
        
    
    
    hello
    
    
    

提交回复
热议问题