cmeadmore Posted November 8, 2016 Share Posted November 8, 2016 Hi, I've used this CSS to create a fixed header with a black background: #header { position:fixed; z-index: 1; background-color: black; padding-top: 40px; width: 100%; padding-bottom: 40px; } The head fixes great but it drops by some 40 pixels so the content beneath appears above it... what am I doing wrong? I need to push the header back to the top of the page! Thanks.C Link to comment
thedillonator Posted January 29, 2017 Share Posted January 29, 2017 You're almost there @cmeadmore. It's hard to help without a link to your site, but this should get you started. First, on the original code you provided, you need to change the margin value to push the header to the top of the page. So it should look like this: #header { position:fixed; z-index: 1; background-color: black; padding-top: 40px; width: 100%; padding-bottom: 40px; margin-top: 0px; } And second, copy/paste this into the Design > Custom CSS panel, to push the page content below the header. You can change out the '87px' for whatever looks good on your site. @media only screen and (min-width: 760px) { .site-page { padding-top: 87px !important; } } (The '@ media' callout just ensures your page content won't be pushed down on mobile devices) Link to comment
8en8ell Posted January 29, 2018 Share Posted January 29, 2018 Got this to work great but my banner descriptions seem to be scrolling over top of my navbar now while the content scrolls behind. Any ideas how to fix this? Link to comment
8en8ell Posted January 29, 2018 Share Posted January 29, 2018 Got this to work great but my banner descriptions seem to be scrolling over top of my navbar now while the content scrolls behind. Any ideas how to fix this? Link to comment
alexdimella Posted August 15, 2018 Share Posted August 15, 2018 Almost works! My banner covers my nav and I have to scroll down to see it after the banner is out of frame. Any way to force the nav contents to the top? Thanks,Alex Link to comment
apple_pie777 Posted April 13, 2020 Share Posted April 13, 2020 Hi guys! I need this answer too ❤️ Anyone could help? Link to comment
tuanphan Posted April 14, 2020 Share Posted April 14, 2020 12 hours ago, apple_pie777 said: Hi guys! I need this answer too ❤️ Anyone could help? Add to Home > Design > custom CSS header#header { position: fixed; left: 0; right: 0; } main#page { margin-top: 100px; } Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
dgirardi Posted October 1, 2020 Share Posted October 1, 2020 Hi all. Trying to implement the code options above but the space between the header and content ends up being different on various pages. Any ideas? Thanks. Link to comment
tuanphan Posted October 2, 2020 Share Posted October 2, 2020 On 10/1/2020 at 6:24 PM, dgirardi said: Hi all. Trying to implement the code options above but the space between the header and content ends up being different on various pages. Any ideas? Thanks. Can you share site url? We can check easier. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.