Div Width Problem...

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I have a DIV for the content of a page which shows/renders properly in Mozilla but not in IE 5,

I have the following CSS:

#body {
position:relative;
margin:40px 70px 0px 70px;
background:#ffffff;
font-size:10pt;
padding:10px;
z-index:1;
}

In IE5 the DIV goes off the right of screen by about 70px; giving the viewer a horizontal scroll bar, how do I fix this?

...Hope you know what I mean because I can't upload anything at the moment (no working FTP program availiable)...

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

You can use IE as an FTP client. Type ftp://user:[email protected]/remote_directory

Not sure about your DIV problem.

Busy's picture

He has: 6,151 posts

Joined: May 2001

take out the z-index:1; (even the position:relative; isn't needed)

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I took out the z-index:1; and the position:relative; but it still gives me the same problem in IE5 :S Cry

dk01's picture

He has: 516 posts

Joined: Mar 2002

Its because the auto-width will be 100% and therefore 100% + 70px margin is greater than the width of the page. You could try using padding instead but I am not sure how the position: relative will affect it. I have stopped using position: relative as it is not a very flexible measure. Why not leave out the position: and instead just use width: auto or width: 100% ?
As far as I know Mozilla 6 and possible NS7 are the only browsers that get relative positioning right.
-dk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.