PDA

View Full Version : Div tag definitions... help.



FordCorsair
10-26-2005, 07:45 AM
what does:

absolute
relative
static

mean when i use these on 'div' tags?

From what I can gather so far 'relative' seems to create what I'd call a layer (dreamweaver user) that can placed in an exact position. As for the other two I can't see what they do.

Thanks

mwinter
10-26-2005, 04:00 PM
what does:

absolute
relative
static

mean when i use these on 'div' tags?Precisely what they mean when you use them with pretty much any other element. They are CSS position property values that affect how an element is placed within the canvas, and how it affects other elements around it. The CSS specification (http://www.w3.org/TR/REC-CSS2/) explains the positioning schemes (http://www.w3.org/TR/REC-CSS2/visuren.html#positioning-scheme) in more detail than I will here.

The static value is default for all elements, and produces the normal flow of elements that you'll expect when writing unstyled markup.

The relative value is similar to static in that the initial location of that element will be the same, and surrounding elements will behave as if the positioned element was in that location. How relative-positioning differs is through the use of the box offset properties (top, right, bottom, and left), which allow the element to be shifted from it's initial position.

The absolute value is very different from the first two. First, it takes the element out of normal flow, which means that other elements act as though the positioned element doesn't even exist. Secondly, it is positioned with respect to a 'containing block'; an element with a position value other than static, or the initial containing block (the document root). The box offset properties specify how far the edges of the absolutely-positioned element are from the containing block.

The fixed value, one that you omitted, is a subcategory of absolute positioning. The element isn't positioned relative to an element, but to the viewport. Unfortunately, IE doesn't support this.

Mike

jscheuer1
10-27-2005, 06:20 AM
The fixed value, one that you omitted, is a subcategory of absolute positioning. The element isn't positioned relative to an element, but to the viewport. Unfortunately, IE doesn't support this.

Except for the page background.

mwinter
10-28-2005, 01:01 PM
The fixed value, one that you omitted, is a subcategory of absolute positioning.Except for the page background.Fixed backgrounds are rather unrelated to fixed positioning. However, IE gets both wrong.

Ian Hickson has a test page for fixed backgrounds (http://www.hixie.ch/tests/evil/mixed/bgafixed.html). IE renders the background on the body element correctly, but fails to render the element background in the proscribed manner.

Be warned: My IE 5.5 crashed when I viewed this. IE 5.01 didn't render any of the images, though IE 4.01 behaved like IE 6. This is probably a problem with my installation, but be prepared.

Mike