On 7 apr, 03:37, Tony <[email protected]> wrote: > I have a css that aligns my content to the center of page using > statement [...] > <body> > <div id="align_body"> > <div class="shade1_menubar"> > > </div> > </div> > </body> > > The problem I'm having is that content of <shade1_menubar> div always > aligns to the <body> div and not to the <align_body> div. From what I > know about css - the absolute position of the div inside would align > to its parents div - in this case <align_body> is parent of > <shade1_menubar>.
The positioned element is aligned to the html element or the nearest ancestor with position set to a value other than 'static'. "The containing block for a positioned box is established by the nearest positioned ancestor (or, if none exists, the initial containing block, as in our example)." http://www.w3.org/TR/CSS2/visuren.html#comp-abspos To make the element align to the #align_body element, you have to set the position property for that element, e.g.: #align_body { position: relative; ... } -- -- You received this because you are subscribed to the "Design the Web with CSS" at Google groups. To post: [email protected] To unsubscribe: [email protected] To unsubscribe, reply using "remove me" as the subject.
