In CSS, an absolutely positioned element is positioned in relation to what?
The CSS spec says that absolute elements are positioned with respect to the box's *containing block* . For an absolute element, the containing block is established by the nearest ancestor with a 'position' of 'absolute', 'relative' or 'fixed'. If there is no such ancestor, the containing block is the initial containing block. 
In other words, an absolutely positioned element is positioned in relation to its nearest positioned  ancestor. If the element has no positioned ancestors, it will be positioned in relation to the initial containing block. Depending on the user agent, this will either be the canvas or the HTML element. 
 CSS 2.1 Specification's definition of "containing block"
 In CSS, what is a "positioned element"?
 p. 59 of Andy Budd's "CSS Mastery"