a little late to give an answer, but it may help someone in the future, I came up with this problem not so long ago, so here is my shot at it using jquery, since I could not come up with a CSS solution that did not remove the DOCTYPE tag (which you don’t have to do anyway).
So there it is.
$("#CONTAINERDIV").prepend("<div id='relativefix' style='position:relative;margin-top:"+($("#YOUR_ABSOLUTE_DIV").offset().top+$("#YOUR_ABSOLUTE_DIV").outerHeight()+30)+"px'></div>"); $(window).resize(function(){ $("#relativefix").css("margin-top",($("#YOUR_ABSOLUTE_DIV").offset().top+$("#YOUR_ABSOLUTE_DIV").outerHeight()+30)+"px"); });
So, yes, all that is for you, just dynamically add another div at the beginning of the container, rigidly placed under the absolute div, which will make all subsequent relative divs me fit after it, this seems like a clear fix for those who have run out of ideas .
source share