The position property controls how an element is placed in the document and how it behaves when you scroll, resize, or align layouts.
Types of Position in CSS
1. Static (Default)
2. Relative
3. Absolute
4. Fixed
5. Sticky
1. Static (Default) Behavior
- Default position for all elements
- Top Left Right Bottom do not work
- Follows normal HTML flow
2. Relative Behavior
- Moves relative to its original position
- Original spaces is still reserved
- Removed from normal flow
- Positioned relative to nearest positioned parent
- If no parent → relative to body
- Positioned relative to viewport
- Stays fixed while scrolling
- Acts like relative initially
- Becomes fixed after scroll reaches a point













No comments:
Post a Comment