Erik,
No problem at all! Happy to provide some guidance around possible styling options.
For context, the right-alignment is dictated by the default styling that Zendesk assigns the navigation bar, containing both the “breadcrumbs” on the left side as well as the Yext search bar on the right. I’ve highlighted this container in the screenshot below:
Default styling for this container in Zendesk uses Flexbox to push the two elements within the container, the breadcrumbs and the searchbar, to the far sides of the container and leave as much space as possible between the two (highlighted in purple above).
Due to this default setup, it is a bit tricky to cleanly center-align the search bar while keeping the breadcrumbs left-aligned. Here are a few potential options that can serve as starting points for you to experiment with:
Option 1: Center-align all of the navigation content
Instead of having the items within the nav container pushed to either side, you could simply center all of the nav content by changing the justify-content
property for the .sub-nav
css stylings that already exist within the styles.css
file. Instead of “space-between”, you’d use “center”.
Then, you’d probably want to add some space in between the breadcrumbs and the search bar by adding something like padding-left: 20px
to .search-container
. This would look something like the following:
If you’d like to keep the breadcrumbs left-aligned and only move the search bar to the center, you could try taking a slightly different approach. Instead of setting justify-content: center
on .sub-nav
, you could set justify-content: left
.
This will left-align both the breadcrumbs and the search bar. Then, you could padding-left
to the search bar element to push it towards the center and away from the lefthand side. This approach would require some trial and error to see exactly how much left padding is required to make the search bar appear directly in the center of the sub-nav element, and may also require some device-specific styling to keep things mobile-friendly.
The following screenshot shows an example of using justify-content: left
on .sub-nav
with padding-left: 16rem
on .search-container
.
These are the two easiest approaches I can come up with for a more center-aligned search bar. To be able to more automatically center the search bar while leaving the breadcrumbs on the left, you would most likely need to rework the structure of the HTML so the search bar did not share the same parent container as the breadcrumbs. That would get fairly complex, so I wanted to share these simpler solutions as inspiration!
Hope this proves useful,
DJ