tags:

views:

54

answers:

2

Hi StackOverflow!

I want to display a div with a background image called something like this:"image_(1)_125x192.jpg". It doesn't display, presumably due to the ")". Is there a way around this without renaming the image?

#div {
    background-image: url(image_(1)_125x192.jpg);
    height: 192px;
    width: 125px;
}

Thanks!

+7  A: 

Use quotes

background-image: url("image_(1)_125x192.jpg");

w3 reference: http://www.w3.org/TR/CSS2/colors.html#propdef-background-image

Gaby
Holy Shit I love this site! Works like a charm, thanks :)
Cenk
You should get into the habit of using quotes by default. In my experience it saves so much hassle, you know it's *always* going to work.
DisgruntledGoat
Of course, it is possible to create a file with a single quote, a double quote, and a right parenthesis in the name. You would have to hate yourself to do such a thing, but the point I'm trying to make is that Punycode is the way out when nothing else works. It should be avoided, of course, but I thought it was worth pointing out.
WCWedin
+5  A: 
#div {
    background-image: url('image_(1)_125x192.jpg');
    height: 192px;
    width: 125px;
}

note the quote

Raveren