Forum Moderators: not2easy

Message Too Old, No Replies

background image issue is ie 7 but not firefox or opera

         

michaelh613

1:10 am on Aug 31, 2008 (gmt 0)

10+ Year Member



I have a left side box


#signup{
position: relative;
float: left;
top: 0px;
padding-left: 0px;
padding-right: 0px;
height: 135px;
width: 180px;
border:thick;
/*background:url(../images/background.png);
background-repeat: no-repeat;
*/
background-color:#000000;
}

xhtml


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gas Savings Netword</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id ="wrapper">
<div id ="header">
<ul>
<li class="contactlink"><a class="contact" href="#">CONTACT US</a></li>
<li class="managementlink"><a class="management" href="#">MANAGEMENT</a></li>
<li class="compensationlink"><a class="compensation" href="#">COMPENSATION</a></li>
<li class="howlink"><a class="how" href="#">HOW IT WORKS</a></li>
<li class="joinlink"><a class="join" href="#">JOIN</a></li>
<li class="homelink"><a class="home" href="#" title="Home">Home</a></li>
</ul>
</div>
<div id="clear"></div>
<div id="content">
<div id="maincontent">
<h1>test</h1>
<p>What is a gas rebate</p>
<p>&nbsp;</p>
</div>
<div id="secondarycontent">
secondary content
</div>
</div>
<div id="signup"><h2>Sign Up Today</h2></div>
<div id="dream">
<h3>test</h3>
</div>
</div>
</body>
</html>

Everything validates.

When I use the background image in IE 7 only part of the image shows but it works completely find in Firefox and opera. However when use background-color it works ok in all three browsers.

So I'm wondering what IE-7 might be doing to my background image.

Marshall

4:56 am on Aug 31, 2008 (gmt 0)

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



Have you done your background this way -

background: #000 url(../images/background.png) top left no-repeat;

Your other choice -
background-image: url(../images/background.png);

Marshall

swa66

10:41 am on Aug 31, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As Marshall said, I've seen strange things happen if you use shorthand notations together with the more detailed ones.

Problem is that it doesn't seem to trigger the problem with the sample you posted.

Still, it smells like a IE7 bug, try giving the parent "has layout"


<!--[if IE 7]>
</style type="text/css>
#wrapper {
zoom:1
}
<style>
<![endif]-->

Oh, a tip: one can easily id on any element, no need to use extra divs.


<div id="dream">
<h3>...</h3>
</div>

can most likely be done as:

<h3 id="dream">...</h3>

Don't use extra divs unless you need them, it's IMHO an equally bad practice as abusing tables for layout.

michaelh613

11:32 am on Aug 31, 2008 (gmt 0)

10+ Year Member



I did resolve my issue. My reason for using the div rather than just idyingth element is that I will have other element behend the background. This look and feel will be on multiple pages. I use divs to logically layout different sections ie divisions of the page so I think it is semantically correct but I understand and appreciate you comments about not replacing tables with divs.