css - positioning an element absolutely *within* another element -
this question goes css wizards. i've googled , couldn't find answer. @ point i'm not sure it's possible:
how specify position of element within element, semi-absolutely speak?
i want "put element inner x pixels right of outer's left border, no matter outer happens @ moment."
this might possible javascript, shouldn't possible css?
#inner { position: absolute; left: 10px; }
what css position #inner
element 10px left border of 'closest' parent has position value of absolute
, relative
, or fixed
. if no such element found, absolute positioned relative body
element, if make sure inner element has parent has position defined css, positioned absolutely within parent.
take @ jsfiddle. first, @ html , css see how constructed, go ahead , use mouse drag either of element around (that's javascript in does, purely demonstration purposes). notice how when drag outer element, inner 1 moves it? doing when drag elements around changing values of top
, left
properties, , since parent absolute positioned, child element stay @ same spot within no matter move on screen. :d
Comments
Post a Comment