Forum Moderators: not2easy

Message Too Old, No Replies

Background Images - This should be so simple!

Images not showing up in some browsers

         

stevecopley

7:58 pm on May 12, 2007 (gmt 0)

10+ Year Member



Hello

This is driving me nuts - can anyone help?!

All I want is to add background images to some divs. Nothing to it... but the images are not showing in some browsers (Safari, FF2) but show fine in others (Camino). The code validates (both HTML and CSS).

I've been through endless websites looking for clues. The images are there, the paths to them are correct (I've tried both absolute and relative paths, but no difference)

What am I doing wrong?!

Here is a test example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Copleys</title>
<meta name="generator" content="TextMate">
<meta name="author" content="Steve Copley">

<style type="text/css">
body {
background-color: #F5F4F4;
color: #666;
font: normal 15px/1.1em Helvetica, Arial, sans-serif;
margin: 0px;
padding: 0px;
text-align: center;
}

#container {
width: 700px;
margin: 20px auto;
padding: 0px;
text-align: left;
}

#home {
width: 700px;
padding: 0;
margin: 0 0 20px 0;
border: 1px solid #666;
background-color: #999;
text-align: left;
clear: both;
height: 400px;
background-image: url(http://www.example.org/images/banners/banner_main.jpg);
}

h1 {
font-family: Helvetica, Verdana, Arial, Sans-Serif;
font-weight: bold;
text-align: left;
clear: both;
margin: 360px 0 0 30px;
padding: 0;
font-size: 26px;
color: #fff;
}
</style>
</head>

<body>
<div id="container">
<div id="home">
<h1>TEST TITLE</h1>
</div>
</div>
</body>
</html>

Any help greatly appreciated (and I'm quite happy to have someone point out that I've done something stupid!)

Best regards

Steve Copley

[edited by: encyclo at 11:50 pm (utc) on May 12, 2007]
[edit reason] See Guide to Posting Code [webmasterworld.com] [/edit]

Marshall

8:52 pm on May 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One method would be to stack two <DIV> with the bottom one containing the image and the top one with no background or a transparent background. It's a work-around that generally works.
post Script: Not sure how important the image-repeat is.

[edited by: Marshall at 8:54 pm (utc) on May 12, 2007]

zackattack

11:56 pm on May 12, 2007 (gmt 0)

10+ Year Member



works fine in FF2 for me, not sure about Safari, but should be ok.
Ok silly question coming up.... with using full URL in there, were you connected to the internet at the time..?

ZA

stevecopley

8:43 am on May 20, 2007 (gmt 0)

10+ Year Member



I got the solution on another forum - I'll post it here for reference...

Don't put your images in a folder called 'Banners' if you don't want your images to be blocked by ad-blocking software!

Yes... it was that simple and, yes... I do feel stupid! ;-)

Steve