The are different types of positions like x,y,z to set the position of the element wrt to DOM.
By default position is set to static
- relative
- doesn't consider other element only its immediate ancestor, it can overlap other elements
Use z index to set the zth dimension
- Absolute
- Checks relevance to its immediate ancestor
- Fixed
- Fixes the element on the screen, regardless of the DOM
- Sticky
- Sticks to the webpage when it has to disapper in the page. It is sticked to the page until it has no diappering property like no "scrolling" and the screen is at default view.
You do have to specify the directional position when you make it sticky , ex: default for nav bar is top:0px;, it uses the static property
NOTE: transform , filter or perspective propteries are also considered as positioning an element so their child might use them as relevance while using absolute properties.
Next