PDA

View Full Version : Position in IE vs FF



Blind Zero
Mar 30th, 2007, 05:57 AM
I have all of my rough coding done and I am using absolute position to keep a DIV where I want it. But it appears for it to be where I want it it has to be left by 210px in Firefox and just 200px in IE. Is there any real solution for this or do I need to go about it a whole other way?

felgall
Mar 30th, 2007, 06:46 AM
Sounds like you don't have it enclosed in an element with position:relative and so are defaulting to an absolute position relative to the window rather than an absolute position relative to the element it is supposed to overlay. See http://www.felgall.com/cshow09.htm for how to use position:absolute properly.

Blind Zero
Mar 30th, 2007, 07:11 AM
Thank you, I will read this article as soon as possible. I will also post the CSS, and any additional help is greatly appreciated. :)



body , html {
background-color: #000000;
background-image: url(images/background.gif);
background-position: top center;
background-repeat: repeat-y;
margin-top: 0px;

}


/* Container */

div#container {
width: 600px;
position: absolute;
left: 210px;
border-left: 2px dotted;
border-left-color: #000000;
border-right: 2px dotted;
border-right-color: #000000;
height: 100%;
background-image: url(images/containerbg.gif);
background-position: bottom right;
background-repeat: no-repeat;
}

felgall
Mar 30th, 2007, 12:24 PM
That code is missing the element with the position:relative that you are tryong to position your container over. You need a position:relative element first and then position your position:absolute containers within it so that they overlap the way you want. If you don't want them to overlap then ise margins and padding to position your content instead.