Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS background: url, no work when the url have brackets

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

like image 919
rudighert Avatar asked Jan 17 '14 14:01

rudighert


2 Answers

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

like image 77
Ruddy Avatar answered Oct 05 '22 22:10

Ruddy


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;
}
like image 38
TechNyquist Avatar answered Oct 06 '22 00:10

TechNyquist