1

I have a link with a backround image.

The problèm: background-image: url() doesn't work with link contain space. I tried to encode the url but didn't work:

<a href="#" style="background-image: url(http://127.0.0.1:8082/server/php/files/1 (2).jpg)"></a>

I will be thankful for any help.

Sebastian Brosch
  • 42,106
  • 15
  • 72
  • 87
famas23
  • 2,072
  • 4
  • 17
  • 53
  • 3
    Spaces are represented as `%20` in HTML, but I recommend simply renaming your file to **not** have a space. As an alternative, wrapping the string inside `url()` in single-quotes should work as well. – Obsidian Age Aug 02 '17 at 21:28

1 Answers1

3

Embed the address with single quotes,

 <a href="#" style="background-image: url('http://127.0.0.1:8082/server/php/files/1 (2).jpg')">

or, preferably, don't use spaces.

Andy G
  • 19,232
  • 5
  • 47
  • 69
  • Thank you for replying i really appreciate, i will change the file renaming process. I will accept your response i 8 minutes – famas23 Aug 02 '17 at 21:34