Topic: Absolute position DIVs in DIVs |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: Phoenix |
posted 11-14-2004 02:36
Hello, |
Paranoid (IV) Inmate From: France |
posted 11-14-2004 02:53
The position of the child DIV is absolute from the the parent IF the parent specify that its own position:absolute;. In you example it would be : code: <div id="parent" style="position:absolute; width:200px; height:200px;"> And don't forget the closing " when specifying an inline style |
Bipolar (III) Inmate From: Phoenix |
posted 11-14-2004 03:39
Is it possible/reliable to achieve "relative" positioning of a child DIV when the parent DIV is NOT absolute positioned by setting right-margin and bottom-margin properties for the child div? |
Paranoid (IV) Inmate From: France |
posted 11-14-2004 04:11
well to position an element relatively, you should use the position:relative; , which actually is relative to the inline elements, to the previous sibling node to be more precise, which themselves depend of the position of the parent. |
Bipolar (III) Inmate From: Phoenix |
posted 11-14-2004 04:13
Nothing like a little trial and error! |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 11-14-2004 04:40
quote:
|
Bipolar (III) Inmate From: Umeå, Sweden |
posted 11-14-2004 06:27
Well, poi isn't quite right there: Absolute is relative to the closest positioned ancestor. That includes elements of both absolute and relative position. Only statically positioned elements are not counted as positioned. The only g5 browser that doesn't get this right is ie5.0w. All other g5 browsers, including ie5m and ie5.5w, get it right. The g6 browsers also get fixed positioning right. (Well, not prefectly right, but close to it.) Relative positioning is relative to the place the element would have been in if it were static. Fixed positioning is relative to viewport (window working area). |
Bipolar (III) Inmate From: Phoenix |
posted 11-14-2004 06:32
liorean: summary please ; ) |
Bipolar (III) Inmate From: Umeå, Sweden |
posted 11-14-2004 08:34
Heh, that page is for testing how your browser manages. But I guess the summary is as such: (Note that this does not test for other interactions, such as floats.) |
Bipolar (III) Inmate From: Phoenix |
posted 11-14-2004 09:18
Thanks - that helps a lot! (will probably have some more questions in the next day or so) |