tl;dr
- I’ve been working on a global navigation bar that I want to sit above the Main Discourse Menu. I want to be able to use this same code to place this exact same menu atop my Wordpress Main Menu; seamless UX.
- I need help getting my header to be fixed, above the discourse main menu
- When I have my 5 links spaced at 20%, the last one wraps to the next line but when I have it set to 19.8% it doesn’t wrap. How can I optimize the spacing/width in my code?
I like the respective search tools and other parts of the main headers in both WP and Discourse so I’ve decided to keep those intact beneath my custom navbar. But I want to make it easy for my users to get between my LMS (via WP) and the community discussions in Discourse. I’ve designed my HTML/CSS to hide the text for each button, for mobile devices, making it feel more like an application.
I tried to follow the advice offered in a few forums here like the “Best way to customize the header” topic, but I can’t figure out why my nav bar seems to be sitting behind the main discourse nav bar.
I also want the navbar to be sticky so that it remains at the top of the screen, so that when a user scrolls down, they will always see this navbar at the top of their screen.
Here’s a GIF showing what’s happening when I refresh my screen…
Here’s my live site (a big WIP right now
)
Here’s my current HTML/CSS that I’ve placed within the “Customize” admin ui…
HTML:
<div class="navbar"> <a class="rt-border" href="https://jewelbound.com"><i class="fa fa-fw fa-home"></i><span> Home</span></a> <a class="rt-border" href="https://community.jewelbound.com"><i class="fa fa-fw fa-comments"></i> <span>Community</span></a> <a class="rt-border" href="https://jewelbound.com/courses"><i class="fa fa-fw fa-edit"></i><span> Courses</span></a> <a class="rt-border" href="#"><i class="fa fa-fw fa-star"></i> <span>Resources</span></a> <a href="#"><i class="fa fa-fw fa-calendar"></i><span> Events</span></a> </div> CSS:
/* Style the navigation bar */ .navbar { margin: 0; width: 100%; position: fixed; line-height: 50px; background-color: #B7234C; } /* Navbar links */ .navbar a { float: left; text-align: center; color: white; text-decoration: none; font-size: 1.1em; width: 19.8%; } .rt-border { border-right: 2px solid #d6295a; } /* Navbar links on mouse-over */ .navbar a:hover { background-color: #961d3f; } /* Add responsiveness - will automatically display the navbar vertically instead of horizontally on screens less than the number of pixels defined here */ @media screen and (max-width: 940px) { .navbar{ display: flex; } .navbar span{ display: none; } } 


.
