Nicolas Pierre
Nicolas Pierre

Reputation: 1195

Div Background Isn't Getting Set

#contentwrapper {
   background: #111;
   background: url('~/img/bg-black.png');
   width: 100%;
}
#content {
   width: 340px;
   height: 165px;
   margin: 240px auto;
   text-align: center;
}

Here's the HTML:

<div id="content-wrapper">
<div id="content">
<h1 style="text-align: center">Test</h1>
<div style="clear:both"></div>
</div>
</div>

My problem is that I m trying to set the background image of contentwrapper to the given link, but when I run it, it doesn't get shown. I tried rewriting, reloading, readding, etcetera. Nothing works

Any idea's?

Upvotes: 0

Views: 63

Answers (2)

James Johnson
James Johnson

Reputation: 46067

Try removing the tilde (~) character, and map it from the root of the site. You can also try removing the quotes or using double quotes, but it should work either way:

background: url(/images/dialog-gradient-beige.png);

If you can't map it from the root of your site, try backing out to the images directory:

background: url("../images/bg-black.png");

Upvotes: 1

Simon Arnold
Simon Arnold

Reputation: 16177

Spelling mistake
id contentwrapper

<div id="content-wrapper">

Upvotes: 5

Related Questions