Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIV Floating Issues 1

Status
Not open for further replies.

thenewa2x

Programmer
Dec 10, 2002
349
US
This following page works in Firefox but not in Internet Explorer. Is there anyway I can make it work with both browsers?

CSS:
Code:
/**
* Main Style
*/
body,td,th,div {
	font: 12px Arial, Helvetica, sans-serif;
	color: #000000;
}
body {
	background-color: #E1D4C0;
	margin: 0px;
}

/**
* DIV Header Style
*/
#head {
	background: #143771 url(headbg.gif) repeat-x left top;
	height: 70px;
	text-align: center;
	padding: 0px;
	clear: both;
}
#head #hold {
	margin: auto;
	width: 850px;
	clear: both;
	padding: 0px;
}
#head #hold #left {
	float: left;
	width: 50px;
	background: url(headl.gif);
	height: 70px;
	clear: left;
}
#head #hold #middle {
	width: 742px;
	background: url(head.gif) no-repeat left top;
	height: 68px;
	margin-right: 50px;
	margin-left: 50px;
	text-align: left;
	vertical-align: top;
	color: #FFFFFF;
	padding: 2px 4px;
}
#head #hold #right {
	background: url(headr.gif) no-repeat right top;
	height: 70px;
	width: 50px;
	float: right;
	clear: right;
}

HTML:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="img/style.css" rel="stylesheet" type="text/css" />
<title>Flock</title>
</head>

<body>
<div id="head">
  <div id="hold">
    <div id="left"></div>
    <div id="right"></div>
    <div id="middle"><img src="img/logo.gif" width="178" height="70" /></div>
  </div>
</div>
<div id="divider"></div>
<div id="content">
  <div id="hold">
    <p>Content.</p>
  </div>
</div>
</body>
</html>

I only gave the header CSS code because that is the only part I'm having the problem with.

---------------------------------------
TINSTAAFL, which is why I contribute.
 
That's a good-looking layout you have there. I can't see what IE is objecting to, but I have two suggestions...

1. Try giving various divs [tt]position:relative;[/tt]. That sometimes clears mystery IE bugs.

2. Get rid of div#left and div#right. Instead, make a 850px wide background with the left & right shadows on it (the bit that'll end up behind div#middle can be a plain colour) and make it the background for div#hold. Alternatively, put another nested div inside div#hold, say div#hold2, then give div#hold headl.gif as a background image and div#hold2 headr.gif, each background-positioned into the relevant corner. Either way, getting rid of those two floating divs will simplify your markup and may get IE to behave.



-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Thanks! And thank you for the comment.

(I can't believe I didn't think of that...)

---------------------------------------
TINSTAAFL, which is why I contribute.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top