I'm doing a page right now, and i just realized I don't know anything about positioning tools to use on a page when positioning things. whats a good one to use?

1 answer

danwellman 5600
0
points

Positioning tools? If you mean the different types of position an element can have - relative, absolute, static, fixed - then the best thing to do generally is to rely on the flow of the document as much as possible without specifying any positioning, and when positioning is required, use whichever form of positioning makes sense

Relative positioning - elements will remain in the flow of the document and will affect the position (on the page) of other elements around them. This is useful for containers or other elments whose position on the page needs to be adjusted

Absolute positioning - elements are removed from the flow of the document and do not affect other elements around them. They take their position from the nearest relatively positioned parent, or the document if no parents are relatively positioned. This is useful for things like drop down menus that you want to overlay other content, or floating 'popups' (not popups as in external windows, but popups made from elements already in the page but hidden from view)

Fixed positoning - elements are removed from the flow of the document and always retain their position relative to the viewport, not the page. So if a fixed element is set to the top of the window, it will always occupy space at the top of the window, even when the document is scrolled down (or accros). This is useful for things like the digg bar.

Static positioning - this is the default mode of positioning if none other is specified - elements are placed where they would naturally be in the flow of the document.

There is no simple answer to this question because it very much depeneds on exactly what you are trying to achieve.

Answered almost 7 years ago by danwellman