CSS Properties
The position property
body {
position: static
}
https://www.youtube.com/watch?v=jx5jmI0UlXU&t=5s
- static
default position of all HTML elements - follow other elements in the document flow - left to right, top to bottom.
- relative
offset an element ( via top, bottom, left, right properties ) relative to its static position (itself). Rarely used.
- absolute
Completely remove the element from doc flow, and offset an element ( via top, bottom, left, right properties ) with respect to the inner most parent with non-static parent. a parent with “relative” positioning is the most common usecase
- fixed
Completely remove the element from doc flow, and offset an element with respect to the HTML. Also, the element remains fixed with respect with page scrolling
- sticky
combination of relative and fixed together. relative until reaching a screen edge. sticks to an edge of window if the right ( via top, bottom, left, right properties ) is supplied https://www.youtube.com/watch?v=NzjU1GmKosQ&t=318s