The first attempt shall be from w3schools for Positioning.
Note that the two blocks above seem to extend past the right edge of the page. I know this because the bottom line is right aligned.
An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.
A fixed element does not leave a gap in the page where it would normally have been located.
Notice the fixed element in the lower-right corner of the page. Here is the CSS that is used:
Omitting px in the style definition for bottom or right used some strang(?) measurement. When I added px the result was as expected.
An element with position: absolute; is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed).
However; if an absolute positioned element has no positioned ancestors, it uses the document body, and moves along with page scrolling.
Note: A "positioned" element is one whose position is anything except static.
It appears that proper positioning requires measurement expressed as px or something else. It cannot just be a number.
An element with position: sticky; is positioned based on the user's scroll position.
A sticky element toggles between relative and fixed, depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it "sticks" in place (like position:fixed).
I shall omit the exercise for sticky because it uses -webkit-sticky in the style definition; I have not yet learned anything about webkit.
These exercises are not related to the Castro book I am learning from.