+ 2

Can anyone Explain me the Position Property in Html/Css?

I cant understand the difference between values fixed, relative, absolute and static. Their relation with z-index also confuses me.Anyone?

27th Jul 2017, 3:52 PM
Shehzad - avatar
3 Antworten
+ 6
the most used in web site is position: fixed, for the scrollbar in the up of the page ^^ else you can use absolute, relative static
27th Jul 2017, 4:19 PM
NoxFly - avatar
+ 3
Static: default position. Elements in the flow just get stacked one below other. relative and absolute: usually an element with position absolute will be positioned relatively to its parent. If none of its parents has a relative position, then the element is positioned relatively to the body. Fixed: the element is removed from the flow and positioned relatively to the window (typically, it's going to follow the scroll) z-index will only works with fixed, relative and absolute position. It is useful when elements are overlapping to determine which one is on top of the other.
27th Jul 2017, 4:03 PM
Drax - avatar
+ 1
https://www.w3schools.com/Css/css_positioning.asp static is the default position. fixed positions the element in relation to the displayed viewport, unaffected by scrolling absolute positions the element in relation to a positioned element that it is inside of relative positions an element based on it's original location z-index is used to arrange positioned elements that are overlapping into a particular order
27th Jul 2017, 4:03 PM
God Usopp
God Usopp - avatar