Welcome to WebmasterWorld Guest from 54.196.243.192

Forum Moderators: not2easy

Message Too Old, No Replies

absolute positioning different in ie, firefox, netscape?

     
4:44 am on May 1, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 29, 2005
posts:3
votes: 0


Ok, I am new to css so I do not know a whole lot. Anyways I have adapted a template for a website I am making and it doesn't appear the same in all browsers. The problem is with absolute positioning of text. I designed it for internet explorer, so it appears where I want there, but in firefox and netscape it appears just a little bit lower and makes the website not appear how I would like. Is there just a difference in the browsers or something wrong with the coding? Is there a way to make it so it appears the same in all browsers? Here is the coding:
1) in the css:

.headertext {
position: absolute;
left: 460px;
top: 65px;
}

.headertextsub {
position: absolute;
left: 460px;
top: 100px;
width: 300px;
}

and 2) in the body:

<div class="headertext">
<h1>Header</h1>
</div>
<div class="headertextsub">
<h5>Subheader</h5>
</div>

5:09 pm on May 1, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Welcome to the forums, ralphus.

Absolute positioning is measured from the bounds of the containing element, which I am guessing is the <body> in your case. Different browsers have different defaults for margin (and padding) - have you set margin rules for the <body> element? That might do it.

Also, are you sure you want to use absolute position in this case? How about just letting the elements flow with the document. When they first begin to position elements with CSS, people often have a feeling that they always (or often) need to use relative and absolute position -- when that often complicates things unnecessarily.

The natural document flow is often the best place to start - no extra positioning rules at all, and that also helps to generate cleaner mark-up. You can always give your h tags some margin or padding if you want to see them indented.

6:06 pm on May 1, 2005 (gmt 0)

New User

10+ Year Member

joined:Apr 29, 2005
posts:3
votes: 0


Thanks for the response. I just found where to correct it. One change I made caused discrepancy between browsers.
4:49 am on June 2, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 7, 2003
posts:67
votes: 0


it would be good if you had showed us how you fixed the problem...