Is your div showing up at all? You need to make sure that it is showing up first. You may have an error in your code where you do not have the same amount of opening div tags as you do closing div tags, thus it won’t actually display your centerBar2 div.
Are you sure your image is in the right directory, properly named, etc.?
The most likely thing is that you have not entered the correct filepath for the image.
If the CSS file is in folder/ then the image needs to be in folder/images/ - is that what you’ve got? If the images folder is at the same level as the folder your CSS file is in then you need to have …/images/ to get the right filepath.
And the css is as I show above. The images are in the exact same location as the images I use in the header and footer, but these work fine. If I use the path I am using in the css, but use it in the centerBar2 div using the img tag, it displays fine. I cant see what else could be wrong with this.
The link is relative. Thats what makes this wierd. The exact url works in the div if I use an img element. I am going to try a few things and see if I can figure this out.
You genius!! I was just testing and tried using internal css, and it worked fine. Now just tried as you suggested making the path in my external css relative to the css file location, which meant stepping back one folder. Done this and worked great.
I actually just realised now that I have one more issue. This image is being added to a div. My page is a liquid layout. Therefore, I somehow need the background images width to be 100%. I cant however see this option available. Can I set the width of the background image? (I dont want to repeat the image as the image is basically a border for my div)
No you can’t set the width of the background image. What you could do though is to create an extra class for the image and add the image in your html something like:
Problem is, wouldnt that be just like a normal image though, meaning nothing can be placed ontop of it (like text). I do see that CSS3 has introduced background-size: but it doesnt look like it is supported in many browsers.
<div id="container2">
<div id="header2"> <img src="images/HeaderImage.jpg" /> </div>
<div id="leftBar2">
<ul>
<li><a href="#">Register</a></li>
<li><a href="#">Login</a></li>
</ul>
</div>
<div id="centerBar2">
<img class="bg" src="images/CenterBackground.jpg" />
</div>
<div id="middlebar">
<p>Nullam sapien ipsum, ullamcorper ut consequat vel, fringilla a purus. Donec malesuada bibendum bibendum. Quisque eget consectetur diam. Mauris tincidunt pretium bibendum. Cras tincidunt adipiscing lacus, quis sodales purus dapibus vel. Phasellus ut imperdiet justo. Cras sollicitudin, magna et placerat venenatis, dolor mauris facilisis nisi, vitae pellentesque diam felis adipiscing metus. Mauris ullamcorper magna nec arcu sagittis imperdiet. Curabitur vel mauris mauris. Nulla arcu justo, dignissim non vestibulum et, pellentesque nec massa. Nunc euismod, mi vel egestas scelerisque, felis lorem imperdiet mi, eu condimentum purus turpis ut tellus. Ut vel tristique ante. Etiam elit eros, faucibus in dictum ac, venenatis nec metus. Vestibulum in quam ut nulla viverra cursus. Donec eu augue vitae elit sagittis varius. Duis tellus nulla, convallis nec pulvinar vel, pretium eget mauris. Praesent vel risus tellus, vel mollis magna. Fusce tristique est sit amet lectus lacinia at consectetur enim accumsan.</p>
</div>
<div id="rightBar2"> </div>
<div id="footer2"> <img src="images/FooterImage.jpg"/> </div>
</div>