0

I have a css code below:

  background: url('resimler/las-vegas-1366x7 %-68-wallpaper-4495.jpg') no-repeat scroll center center / 100% auto transparent;

That css code above doesn't work. I mean there is this picture, but neither browser nor css does see that.

I know that is a beginner question.. I wanted to search but I couldn't know what to use as keyword..

Thank you.

  • also browser says it is : Bad Request - Invalid URL but the picture is there when I look into the filesystem.. :/ can anyone help me out here? –  Oct 27 '14 at 21:37

1 Answers1

1

Some of the characters have special meaning in URLs and will have to be represented in percent-encoding to counter that.

In your example, the % should be encoded as %25.

url('resimler/las-vegas-1366x7 %25-68-wallpaper-4495.jpg')

With the quotes, the space shouldn't cause issues, but it could also be encoded as %20:

url('resimler/las-vegas-1366x7%20%25-68-wallpaper-4495.jpg')

JavaScript's encodeURI() can be used to help with this.

console.log(encodeURI('resimler/las-vegas-1366x7 %-68-wallpaper-4495.jpg'));
// 'resimler/las-vegas-1366x7%20%25-68-wallpaper-4495.jpg'
Jonathan Lonowski
  • 121,453
  • 34
  • 200
  • 199
  • How can I "decode" a string with ASP.NET C#.? I needed to use the initial form of URI. Thank you.. –  Oct 27 '14 at 22:03
  • http://stackoverflow.com/questions/122641/how-can-i-decode-html-characters-in-c I have read it. But HttpUtility.HtmlDecode() didn't work for me.. The URI is still encoded.. Can you help me? Thanks.. –  Oct 27 '14 at 22:04