Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
Your Position!!!
Best Regards
Kay Udo Georg Veit
Static. This is the default for every single page element. Different elements don't have different default values for positioning, they all start out as static. Static doesn't mean much, it just means that the element will flow into the page as it normally would. The only reason you would ever set an element to position: static is to forcefully-remove some positioning that got applied to an element outside of your control. This is fairly rare, as positioning doesn't cascade.
There are two other things that happen when you set position: relative; on an element that you should be aware of. One is that it introduces the ability to use z-index on that element, which doesn't really work with statically positioned elements. Even if you don't set a z-index value, this element will now appear on top of any other statically positioned element. You can't fight it by setting a higher z-index value on a statically positioned element. The other thing that happens is it limits the scope of absolutely positioned child elements. Any element that is a child of the relatively positioned element can be absolutely positioned within that block. This brings up some powerful opportunities which I talk about here.
The trade-off, and most important thing to remember, about absolute positioning is that these elements are removed from the flow of elements on the page. An element with this type of positioning is not affected by other elements and it doesn't affect other elements. This is a serious thing to consider every time you use absolute positioning. It's overuse or improper use can limit the flexibility of your site.
Position : static- This is the default for every single page element.This means that the element will be placed on the page as the document flow.
Position:relative- This means that the element is positioned relative to itself.
For eg: if you give position: relative and top:10px ,it will shift its position 10px down from where it would normally be.
Position:absolute- This is very powerful as it helps you to place any page element exactly where you want it.You can use the positioning attribute top,left,right and bottom to place the element.This is removed from the flow of elements on the page.An element with this positioning will not be affected by other elements and it does not affect other elements.
Position:fixed- A fixed element is placed relative to the view port or the browser window itself.The viewport will not change when the window is scrolled ,so the element will stay right where it is when the page is scrolled.