positionproperty specifies the type of positioning method used for an element (static, relative, absolute, or fixed).
topproperty affects the vertical position of a positioned element. This property has no effect on non-positioned elements.
- If position: absolute; or position: fixed; - the
topproperty sets the top edge of an element to a unit above/below the top edge of its nearest positioned ancestor.
- If position: relative; - the
topproperty makes the element's top edge to move above/below its normal position.
Right, bottom, and left properties have similar effects.
z-indexproperty specifies the stack order of an element.
An element with greater stack order is always in front of an element with a lower stack order.
z-indexonly works on positioned elements (position: absolute, position: relative, position: fixed).