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

Romaguera Steuber asked on March 27, 2021 11:02

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 background image. No luck with Chrome, Safari or Firefox (haven't tried IE).

Here's an example of what I've tried so far.

< !DOCTYPE html > < html > < head > < title >Experiment< /title > < meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > < style > html,body { width: 100%; height: 100%; } < /style > < /head > < body style="background: url('file:///Users/username/Desktop/background.png')" > < /body >

Recent Answers

Prashant Verma answered on March 28, 2021 19:57 (last edited on March 28, 2021 19:58)

@Romaguera: You have to upload your image file on remote server and need to provide the similar path (Server Path)in background CSS properties.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.