7

I have the next url for an image

url: http://www.andrearosseti.cl/image/cache/data/New%20Coleccion/Planas/SWEET-5-TAUPE-(1)-340x340.jpg

Now, i wont make in my CSS

background: url(http://www.andrearosseti.cl/image/cache/data/New%20Coleccion/Planas/SWEET-5-TAUPE-(1)-340x340.jpg)

the problem is the brackets in the url.

enter image description here

i try scape the bracket, but not work.

Any ideas?

I use Rails and SCSS

Thank

rudighert
  • 315
  • 1
  • 4
  • 11

3 Answers3

12

Here you go: Put \ in-front of the brackets.

HTML:

<div></div>

CSS:

div {
    background: url(http://www.andrearosseti.cl/image/cache/data/New%20Coleccion/Planas/SWEET-5-TAUPE-\(1\)-340x340.jpg);
    width: 400px;
    height: 400px;
}

DEMO HERE

Ruddy
  • 9,795
  • 5
  • 45
  • 66
  • @rudighert Isn't this braces escaping that you said you already tried in the question? How did you try to escape the braces then? – Niki Romagnoli Jul 20 '19 at 10:30
2

Replace braces with encoded braces chars:

div {
    background: url(http://www.andrearosseti.cl/image/cache/data/New%20Coleccion/Planas/SWEET-5-TAUPE-%281%29-340x340.jpg);
    width: 400px;
    height: 400px;
}
Niki Romagnoli
  • 1,406
  • 1
  • 21
  • 26
-1

Wrap the url with quotes:

background: url('http://www.andrearosseti.cl/image/cache/data/New%20Coleccion/Planas/SWEET-5-TAUPE-(1)-600x600.jpg')
Albzi
  • 15,431
  • 6
  • 46
  • 63
akhanubis
  • 4,202
  • 1
  • 27
  • 19
  • @rudighert Is the url encoded with `%25`? In that case, add quotes and change `%25` with `%`. – akhanubis Jan 17 '14 at 14:40
  • Single or double quote the `URL`. Also the current URL goes to a 404 page, `New%252520Coleccion` should be `New%20Coleccion` – Nick R Jan 17 '14 at 14:45
  • sorry, the correct URL is http://www.andrearosseti.cl/image/cache/data/New%20Coleccion/Planas/SWEET-5-TAUPE-(1)-340x340.jpg – rudighert Jan 17 '14 at 14:49