Search code examples
htmlcssgoogle-chromeinternet-explorer-8background-image

Why an inline "background-image" style doesn't work in Chrome 10 and Internet Explorer 8?


Why the following example shows the image in Firefox 4, but not in Chrome 10 and Internet Explorer 8?

HTML:

<div style="background-image: url('http://www.mypicx.com/uploadimg/1312875436_05012011_2.png')"></div>

CSS:

div {
    width: 60px;
    height: 60px;
    border: 1px solid black;
}

Any ideas for workarounds?


Solution

  • As c-smile mentioned: Just need to remove the apostrophes in the url():

    <div style="background-image: url(http://i54.tinypic.com/4zuxif.jpg)"></div>
    

    Demo here