Yasmika Saubhagya Yasmika Saubhagya - 1 year ago 64
CSS Question

Background image doesn't show within the <div> element - CSS/HTML

screenshot of the directory structure
I created a

<div>
element and I'm going to use below
css
style withing the
<div>
element.

#girls {
background-image: url("girl.gif");
}


Here is my HTML
<div>
element (This element contains in
index.html
page):

<div id="girls">
<p>
<b>Girls chat:</b> at the lounge, we're committed to providing you, our guest, with an exceptional
experience every time you visit. Whether you're just stopping by to check in on email over an elixir,
or are here for an out-of-the-ordinary dinner, you'll find our knowledgeable service staff pay attention to every
detail. If you're not fully satisfied, have a Blueberry Bliss Elixir on us.
</p>
</div>


But when I load index page, the background image (girl.gif) doesn't show up. Anyone can help me with this?

Answer Source

Try this:

#girls {
    background-image: url("../girl.gif");
}

I'm guessing that the css is inside that stylesheet folder, that's why you need to go up a level to access girl.gif, thus the usage of ../

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download