1 reply [Last post]
squibs
Offline
newbie
Last seen: 15 years 7 weeks ago
Joined: 2007-10-23
Posts: 2
Points: 0

Hi all. I have a fairly generic 3-col layout with header and footer. In the main content div, I'm using a background image for headings. The problem is that in firefox, the background image starts from the left of the main container, where the left sidebar starts. In IE it starts where I want it. If I adjust the main content css to include
margin-left:144px
to accomodate the width of the left sidebar, this fixes firefox, but IE then displays the background image 144px to the right of where the main content div begins.

Can anybody shed any light on this?

@charset "utf-8"; body { font: 100% Verdana, Arial, Helvetica, sans-serif; background: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #000000; } .thrColFixHdr #container { width: 960px; /* using 20px less than a full 960px width allows for browser chrome and avoids a horizontal scroll bar */ background: #FFFFFF; margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ } .thrColFixHdr #header { padding: 0px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */ } .thrColFixHdr #header img { display:block; } .thrColFixHdr #sidebar1 { display:block; float: left; /* since this element is floated, a width must be given */ width: 144px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */ padding: 0px; /* padding keeps the content of the div away from the edges */ margin: 0px; } .thrColFixHdr #sidebar2 { float: right; /* since this element is floated, a width must be given */ width: 150px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */ background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */ padding: 0px; /* padding keeps the content of the div away from the edges */ } .thrColFixHdr #mainContent { margin: 0px; /* the right and left margins on this div element creates the two outer columns on the sides of the page. No matter how much content the sidebar divs contain, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the sidebar spaces when the content in each sidebar ends. */ padding: 0px; /* remember that padding is the space inside the div box and margin is the space outside the div box */ } .thrColFixHdr #mainContent h1 { display:block; background-color:#CC0000; background-image:url(images/textbox_header_repeat.jpg); background-repeat: repeat-y; margin: 0px 0px 0px 144px;; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */ padding: 0px; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ } .thrColFixHdr #footer { padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ background:#DDDDDD; } .thrColFixHdr #footer p { margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ } .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page */ float: left; margin-right: 8px; } .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ clear:both; height:0; font-size: 1px; line-height: 0px; }

Untitled Document


/* place css box model fixes for IE 5* in this conditional comment */
.thrColFixHdr #sidebar1 { width: 180px; }
.thrColFixHdr #sidebar2 { width: 190px; }


/* place css fixes for all versions of IE in this conditional comment */
.thrColFixHdr #sidebar2, .thrColFixHdr #sidebar1 { padding-top: 0px; }
.thrColFixHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */

HomeMenuEventsJobs
Welcome

squibs
Offline
newbie
Last seen: 15 years 7 weeks ago
Joined: 2007-10-23
Posts: 2
Points: 0

I've just figured out that

I've just figured out that
.thrColFixHdr #mainContent { zoom: 1; }
in the inline IE conditional css causes the problem. I'm still not sure why though.