|
Answer» CSS3 position property allows us to position an element. The types of property values available for a position are STATIC, absolute, fixed, relative, sticky, INITIAL, and INHERIT. - Static: It’s a default value of position to any element. Element is rendered one after the other in order. It’s the way as it is. There’s no change in the display of elements. Which will display in the window with default paddings and margins?
- Absolute: The absolute value is used to position the element relative to its PARENT element. Say if the parent element has ‘x’ margin in the left. The child element ‘y’ margin towards left. The TOTAL margin of the child element would be ‘x+y’.
- Fixed: The fixed value is used to position the element relative to the viewport (browser window) and the position of the element would be fixed.
- Relative: The relative value is used to position the element relative to its normal position.
- Sticky: The stick value is used to position the element based on the user’s scroll. Its position is relative until a given offset position is met. Then it will stick in a place like it’s fixed.
- Initial: This property value allows us to use the default behavior of the element.
- Inherit: This property value allows us to inherit the property of its parent.
|