Home › Forums › Support › Top Bar Fixed This topic has 10 replies, 2 voices, and was last updated 3 years, 4 months ago by Leo. Viewing 11 posts - 1 through 11 (of 11 total) Author Posts November 22, 2017 at 9:34 am #430836 David Hello How can I get the top green bar on this page, so it’s fixed and doesn’t mess around with the blue header bar below… https://www.comfortably-numb.co.uk/dentist/ Trying to get it to work on both desktop and mobile but not having much luck. Green bar just need to stay in a fixed position when scrolling down. Please help. Thanks Dave November 22, 2017 at 11:12 am #430876 LeoStaff Customer Support Hi there, Give this CSS a shot: .top-bar { position: fixed; top: 0; width: 100%; } Adding CSS: https://docs.generatepress.com/article/adding-css/ November 22, 2017 at 5:43 pm #431123 Lyle Hi Leo, I tried this on a local test site and although it does stick on scrolling down, it is initially hidden. I tried a few things but couldn’t get it to “be where it should” and then stick on scroll. Cheers! Lyle November 22, 2017 at 10:49 pm #431244 TomLead Developer Lead Developer The best way to do it is to use position: sticky, although it doesn’t have amazing browser support: https://caniuse.com/#feat=css-sticky .top-bar { position: sticky; z-index: 999; top: 0; left: 0; right: 0; } Otherwise, you can try this: .top-bar { position: absolute; z-index: 999; top: 0; left: 0; right: 0; } body { padding-top: 39px; /* height of your top bar */ } November 23, 2017 at 12:37 am #431298 David Thanks guys, this one worked… .top-bar { position: sticky; z-index: 999; top: 0; left: 0; right: 0; } November 23, 2017 at 7:50 am #431622 Lyle Thanks Tom! π The first one worked fine π November 23, 2017 at 9:24 am #431725 TomLead Developer Lead Developer Can’t wait until position: sticky is better supported π November 29, 2017 at 1:24 am #437643 jesus None Of These Work For Me π November 29, 2017 at 7:42 am #437911 LeoStaff Customer Support Hmm I just tested and it works. Can you link us to your site with the code added? August 12, 2021 at 12:45 pm #1893891 Alex Bukin Hi Leo, I am having an issue with top bar sticky option on all views on scroll. The link to my site https://fr8data.com/ Any idea to resolve the issue? Regards, Alex August 12, 2021 at 1:17 pm #1893912 LeoStaff Customer Support Any chance you can open a new topic for the question? This one is a bit old with multiple authors. Author Posts Viewing 11 posts - 1 through 11 (of 11 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In