I have a position:fixed
element, with a height that differs from page to page. Below this element, I have a position:static
or position:relative
element. Is there a way to have the static/relative element respect the height of the position:fixed element?
I have a fiddle below demonstrating my conundrum:
Just to put the answer as an actual answer:
No, there is no way to have a static/relative element respect the height of the position:fixed element without using JavaScript .
You can do this pretty easily with something like the following jsfiddle:
$('#not-fixed').css('padding-top', $('#fixed').outerHeight() + 10);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.