Can a div
be positioned relative to another div
that is not its parent? Consider this scenario:
<div id="header"><!-- --></div>
<div id="content"><!-- --></div>
<div id="footer"><<!-- --></div>
In the above code, is it possible for #footer
to be relatively positioned in relation to #header
?
UPDATE
I am asking because the layout I have planned visually does not align with the structure of the HTML. On the webpage, there will be a menu at the top and a hidden div that will slide in above the menu when clicked. To achieve this effect, I need to rearrange the order of the divs so that #menu
is relatively positioned below #header
and remains relative when #header
slides in using jQuery's slideToggle()
function.
<div id="menu"><!-- --></div>
<div id="header"><!-- --></div>
<div id="content"><!-- --></div>
<div id="footer"><<!-- --></div>
#header
should remain fixed at the top of the window. #menu
needs to be positioned relative to #header
so that when #header
slides in, #menu
also moves down by the same amount.