Forum Moderators: not2easy

Message Too Old, No Replies

Image Replacement

Aligned differently in IE6 and Firefox

         

gldweb

4:19 am on May 19, 2005 (gmt 0)

10+ Year Member



I am working on a new web site using CSS for the layout and I have run into an issue right off the bat.

The site has a background image of a left column with a dropshadow. The graphic is 780px wide and y-repeats. I am attempting to overlay a page header graphic that should be located at the top of the page.

In IE6 the page header graphic aligns correctly at the top of the page but is off approx. 1 px off the left edge.

In Firefox, the page header renders correctly on the left edge but is about 25px below the top of the page.

Here is a the link:

htpp://www.gldwebservices.com/whalingwest/WhalingWestDesign.htm

Here is the CSS:

body {
margin:0;
padding:0;
text-align:center;
background-image:url(images/left_border.jpg);
background-repeat:repeat-y;
background-position: top center;
background-color:#000000
}
#CenterPage {
width:780px;
margin:0px auto;
text-align:left;
padding:0;
}
#header {
/*image*/
position: absolute;
top: 0px;
left; 0px;
background: url(images/page_header.jpg) no-repeat;
/*image size*/
padding-top: 220px;
width: 780px;
/*hiding text*/
overflow: hidden;
/*IE5 hack*/
height: 0px!important;
height /**/: 220px;
}

Here is the HTML:

<!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>Untitled Document</title>
<link href="whaling_west.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="CenterPage">
<h1 id="header">Whaling West Packaging Corporation</h1>
</div>
</body>
</html>

Any help will be greatly appreciated.

starcutter

5:10 am on May 19, 2005 (gmt 0)

10+ Year Member



gldweb,

I am certainly no expert in CSS...more of a beginner, but I am able to correctly render your page in FF and IE by adding the tag (margin-top:0px;) to the header ID as follows:

#header {
/*image*/
position: absolute;
top: 0px;
left; 0px;
margin-top:0px;
background: url(images/page_header.jpg) no-repeat;
/*image size*/
padding-top: 220px;
width: 780px;
/*hiding text*/
overflow: hidden;
/*IE5 hack*/
height: 0px!important;
height /**/: 220px;
}

starcutter

5:13 am on May 19, 2005 (gmt 0)

10+ Year Member



Oh yeah...I see your error now. You have

top:0px;
left;10px;

Neither of these are valid arguments in CSS...at least not that I am aware of and the second is formated with two semicolons instead of a colon followed by a semicolon.

natty

9:46 am on May 19, 2005 (gmt 0)

10+ Year Member



i would go for the semi colon being the problem..
i am sure that top and left are fine when using absolute positioning ..
i certainly didnt think that top and left were INvalid..
as there isnt much else you can do with absolutely pos'ed stuff.

please correct me if i am wrong though

..

gldweb

3:55 pm on May 19, 2005 (gmt 0)

10+ Year Member



Thanks for the input!

I added the "margin-top: 0px;" to the header ID. That corrected the top alignment in FF. I also corrected the "left; 0px;" argument to "left: 0px;" and changed from absolute to relative positioning.

In IE6, the header is still 1px off on the left. I changed the background color from black to white to see the alignment better.

I tried margin_left: 1px and left: 1px; These correct the rendering in IE6 but screw it up on FF.

Any suggestions?

Thanks

gldweb

6:45 pm on May 19, 2005 (gmt 0)

10+ Year Member



I added a 1px left margin to the body element and everything now is correctly aligned and renders correctly in IE6, FF, Netscape 7.1, and Mozilla 1.7.3.

In Opera 8 the repeated-y left column is not appearing below the header item!? Maybe because I don't have any content there!? I'll add some stuff and see what happens.

Thanks

gldweb

6:36 pm on May 20, 2005 (gmt 0)

10+ Year Member



Actually I spoke too soon. Adding the 1px left margin corrected the alignment in IE6 and did not affect anything on FF but Opera, Netscape and Mozilla all now have the image off to the right by 1 px.

Any thoughts on correcting this?

Thanks

gldweb

12:05 am on May 21, 2005 (gmt 0)

10+ Year Member



After playing with this for quite a bit, I believe the issue is within the body element and not the header.

I have added 1px on the left margin and padding in the body element and it corrects the left alignment of the header with the repeating background in IE6. In FF, Netscape, Mozilla, & Opera, depending whether the browser window is maximized or the horizantal size of the window, the body element background image can be off by 1px.

Any help would be most appreciated.

Thanks