How to Fix Common Twenty Nineteen Theme Menu and Header Layout Issues
Content
Many users of the Twenty Nineteen theme encounter challenges when trying to customize their site's navigation menu and header layout. These issues range from menus not aligning correctly to unwanted spacing and problematic dropdown behavior. This guide compiles the most common problems and their solutions, based on community discussions.
Common Problems and Solutions
1. Centering the Main Navigation Menu
A frequent request is to center the main navigation menu horizontally. By default, the menu might be left-aligned. To center it, add the following CSS code in the Appearance → Customize → Additional CSS section:
.main-navigation {
text-align: center;
}
If this doesn't work immediately, ensure you do not have other plugins or theme conflicts that might be preventing the CSS from taking effect.
2. Reducing Excess Space Below the Menu
Many users find the gap between the menu bar and the page content to be too large. To reduce this padding, use the following CSS snippet in the Additional CSS area. You can adjust the pixel value to your preference.
#main {
padding-top: 20px;
}
3. Increasing Logo Size
Resizing the logo is a common customization. To make it larger without causing layout issues, target the logo image directly. The following code provides a starting point; you may need to adjust values for different screen sizes.
.site-logo .custom-logo {
max-width: 300px; /* Adjust this value */
height: auto;
}
Be aware that a significantly larger logo may require additional adjustments to the header's layout on mobile devices.
4. Fixing Dropdown Menus That Are Cut Off
On pages with a featured image header, dropdown submenus can sometimes be cut off at the bottom of the image. This is often a z-index issue, where the page content sits above the menu. To bring the menu to the front, try:
.main-navigation ul ul {
z-index: 999999;
}
If the submenu is being cut off by a container with the CSS property overflow: hidden, adjusting the z-index may not be sufficient, and you might need to modify the container's properties.
5. Adjusting Overall Header Height
To make the combined header and navigation bar shorter, you can reduce the padding and margins. The following CSS targets the header on larger screens:
@media only screen and (min-width: 768px) {
.site-header {
margin: 0;
padding: .8rem 0;
}
}
Important Notes
- Use a Child Theme: For any modifications beyond CSS, such as editing template files, always use a child theme. This prevents your changes from being overwritten when the theme updates.
- CSS Specificity: If your CSS changes aren't working, the theme's existing styles might be overriding them. Use your browser's inspector tool to identify the exact CSS classes and use more specific selectors or add
!importantas a last resort. - Test Responsiveness: Always check how your changes look on mobile, tablet, and desktop views. Use CSS media queries to apply different styles for different screen sizes.
These solutions address the most frequently reported layout issues within the Twenty Nineteen theme. For more complex customizations, consulting the official WordPress documentation or theme handbook is recommended.
Related Support Threads Support
-
Remove space between header and contenthttps://wordpress.org/support/topic/remove-space-between-header-and-content-5/
-
Star rating upsets line of thumbnailshttps://wordpress.org/support/topic/star-rating-upsets-line-of-thumbnails/
-
I want to reduce the height of the header and navigation menu to 120px.https://wordpress.org/support/topic/i-want-to-reduce-the-height-of-the-header-and-navigation-menu-to-120px/
-
Whitespace too high between menu and top of homepage contenthttps://wordpress.org/support/topic/whitespace-too-high-between-menu-and-top-of-homepage-content/
-
Navigationhttps://wordpress.org/support/topic/navigation-83/
-
The margin between menu and post titlehttps://wordpress.org/support/topic/the-margin-between-menu-and-post-title/
-
Menu editinghttps://wordpress.org/support/topic/menu-editing-4/
-
Centre-align and re-size logo in Twenty Nineteenhttps://wordpress.org/support/topic/centre-align-and-re-size-logo-in-twenty-nineteen/
-
Keep title in row with logo on mobilehttps://wordpress.org/support/topic/keep-title-in-row-with-logo-on-mobile/
-
How to modify site branding containerhttps://wordpress.org/support/topic/how-to-modify-site-branding-container/
-
SVG overwriting menu when floating righthttps://wordpress.org/support/topic/svg-overwriting-menu-when-floating-right/
-
CSS to make logo largerhttps://wordpress.org/support/topic/css-to-make-logo-larger/
-
Space between Menu Itemshttps://wordpress.org/support/topic/space-between-menu-items-7/
-
Align logo in center of the screehttps://wordpress.org/support/topic/align-logo-in-center-of-the-scree/
-
Menu items won’t return from hidden overflow menu when maximizehttps://wordpress.org/support/topic/menu-items-wont-return-from-hidden-overflow-menu-when-maximize/
-
TwentyNineteen Menu-items hidden behind page contenthttps://wordpress.org/support/topic/twentynineteen-menu-items-hidden-behind-page-content/
-
Can Theme 2019 DO THIS?!https://wordpress.org/support/topic/can-theme-2019-do-this/
-
CSS to Center Nav Barhttps://wordpress.org/support/topic/css-to-center-nav-bar/
-
How can I center Main Navigation menu?https://wordpress.org/support/topic/how-can-i-center-main-navigation-menu/
-
Top menu dropdown cut off on single pageshttps://wordpress.org/support/topic/top-menu-dropdown-cut-off-on-single-pages/
-
Space between Menu Itemshttps://wordpress.org/support/topic/space-between-menu-items-6/
-
hamburger navmenu item with children cut off. need to shift lefthttps://wordpress.org/support/topic/hamburger-navmenu-item-with-children-cut-off-need-to-shift-left-2/
-
Menu navigationhttps://wordpress.org/support/topic/menu-navigation-7/
-
center logo in header 2019https://wordpress.org/support/topic/center-logo-in-header-2019/
-
set main menu top of page at homepagehttps://wordpress.org/support/topic/set-main-menu-top-of-page-at-homepage/
-
How best to change the main menu to all vertical?https://wordpress.org/support/topic/how-best-to-change-the-main-menu-to-all-vertical/
-
submenu container full widthhttps://wordpress.org/support/topic/submenu-container-full-width-2/
-
help centering menuhttps://wordpress.org/support/topic/help-centering-menu/
-
How to move the Social Menu up in line with the Main Menu?https://wordpress.org/support/topic/how-to-move-the-social-menu-up-in-line-with-the-main-menu/