Welcome to WebmasterWorld Guest from 54.226.27.104

Forum Moderators: not2easy

Message Too Old, No Replies

absolute positioning different in ie, firefox, netscape?

     

ralphus33

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

10+ Year Member



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>

tedster

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

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



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.

ralphus33

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

10+ Year Member



Thanks for the response. I just found where to correct it. One change I made caused discrepancy between browsers.

metagod

4:49 am on Jun 2, 2005 (gmt 0)

10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month