Advertisement

12.14.2007 at 08:18AM PST, ID: 23023895
[x]
Attachment Details

CSS Margin difference between IE and Firefox

Asked by IShiva in Cascading Style Sheets (CSS), Miscellaneous Web Development

Tags: firefox, css, ie, margin, difference

Hey everyone

I am creating a css layout for a new website. So far, I am simply laying out the divs in a 800px wide main container.

I am noticing that that IE is 1 px off from Firefox on the right side. I have a bg image (830px  wide, white with gradients on each side. This is included in the body css tag)

When I start adding my divs, i notice a 1px white space difference in IE. Firefox displays correctly. I have included my code.

Can anyone see if I am doing something wrong?

Thanks

IShivaStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
 
<div id="MainContainer">
  <div id="HeaderContainer"></div>
  <div id="BodyContainer">
  	<div id="BodyLeft"></div>
  	<div id="BodyRight"></div>
  </div>
</div>
 
</body>
</html>
 
*************************************
CSS
 
@charset "utf-8";
/* CSS Document */
 
body {
	text-align: center; /* for IE */
	background-color: #889fc9;
	background-image: url(../images/bg.gif);
	background-repeat: repeat-y;
	background-position: center top;
	}
	
html, body {
	margin:0px 0px 0px 0px;
}
 
#MainContainer {
	background-color: #FFFFFF;
	width: 800px;
	margin-right: auto;
	margin-left: auto;
	position: relative;
	text-align: left;
	height: auto;
}
#HeaderContainer {
	background-color: #003399;
	height: 120px;
	width: 800px;
	position: relative;
	margin-bottom: 5px;
}
#BodyLeft {
	background-color: #CC3333;
	float: left;
	height: 400px;
	width: 550px;
	position: relative;
}
#BodyRight {
	background-color: #CC66FF;
	float: left;
	height: 400px;
	width: 245px;
	position: relative;
	margin-left: 5px;
}
#BodyContainer {
	height: 300px;
	width: 800px;
	margin-top: 5px;
	position: relative;
}
 
 
[+][-]12.14.2007 at 08:52AM PST, ID: 20472736

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.14.2007 at 09:17AM PST, ID: 20472915

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.14.2007 at 09:51AM PST, ID: 20473149

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Cascading Style Sheets (CSS), Miscellaneous Web Development
Tags: firefox, css, ie, margin, difference
Sign Up Now!
Solution Provided By: GreenGhost
Participating Experts: 1
Solution Grade: A
 
 
[+][-]12.14.2007 at 10:23AM PST, ID: 20473358

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628