{"id":26211,"date":"2020-08-28T12:44:05","date_gmt":"2020-08-28T16:44:05","guid":{"rendered":"https:\/\/www.boldgrid.com\/support\/?p=26211"},"modified":"2024-01-10T12:40:36","modified_gmt":"2024-01-10T17:40:36","slug":"how-to-create-a-horizontal-navigation-menu","status":"publish","type":"post","link":"https:\/\/www.boldgrid.com\/support\/wordpress-tutorials\/how-to-create-a-horizontal-navigation-menu\/","title":{"rendered":"How to Create a Horizontal Navigation Menu"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><p>Sometimes you may want a menu to appear horizontally on your website instead of vertically. Using the Post and Page Builder, our <a href=\"https:\/\/www.boldgrid.com\/wordpress-page-builder-by-boldgrid\/\">WordPress page builder<\/a> plugin, and some simple CSS it&rsquo;s easy to create a horizontal navigation menu and save as a block for use across multiple pages.<\/p>\n<p>This article also provides the CSS needed to convert footer menus in the current default theme, Twenty Twenty-One.<\/p>\n<h2 id=\"create-a-horizontal-navigation-menu-step-by-step\">Create a Horizontal Navigation Menu Step By Step<\/h2>\n<ol>\n<li><a href=\"https:\/\/www.boldgrid.com\/support\/wordpress-tutorials\/how-to-create-a-navigation-menu-in-wordpress-step-by-step\/\">Create a WordPress menu<\/a>.<\/li>\n<li>Edit the page or post where you want to add the horizontal menu.<\/li>\n<li>Click the <b>+<\/b> icon in the DropTab to add a <b>New Section<\/b> for the menu.<br>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-26206\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/droptab-new-section.png\" alt=\"\" width=\"800\" height=\"264\"><\/li>\n<li>Click the <b>+<\/b> icon again and scroll down to widgets to click on <b>Navigation Menu<\/b>. Drag it to the section you just created.<br>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-26209\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/navigation-menu-widget.png\" alt=\"\" width=\"300\" height=\"246\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/navigation-menu-widget.png 593w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/navigation-menu-widget-300x246.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>In the popup, first select the menu you want to use from the dropdown.<br>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-26208\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/navigation-menu-menu.png\" alt=\"\" width=\"300\" height=\"148\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/navigation-menu-menu.png 572w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/navigation-menu-menu-300x148.png 300w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/li>\n<li>Then click the Page icon on the bottom left to add a <b>Custom Class<\/b> and\/or a <b>Custom ID<\/b>. We recommend using a descriptive class and ID, in this example we used only the class horizontal-menu. This class will be used again in step 9. Then close the popup.<br>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-122525 \" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/Horizontal-menu-example.png\" alt=\"\" width=\"321\" height=\"462\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/Horizontal-menu-example.png 448w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/Horizontal-menu-example-208x300.png 208w\" sizes=\"auto, (max-width: 321px) 100vw, 321px\" \/><\/li>\n<li>You can adjust the size and background color of the section as needed, but keep in mind the design will change when the custom CSS is added. When ready, save the page.<\/li>\n<li>Navigate to <b>Appearance <\/b>&gt; <b>Customizer <\/b>&gt; <b>Custom CSS\/JS<\/b>.<\/li>\n<li>Add the code below. If you used the same horizontal-menu class in step 6, you can copy and paste this code exactly. If you used a different class or an ID in step 6, replace horizontal-menu with your class or ID, but be careful to leave the . before the class and if you used an ID don&rsquo;t forget to add a # before the ID!\n<pre>.horizontal-menu ul {\r\ndisplay: flex;\r\nalign-items: stretch;\r\njustify-content: space-between;\r\nwidth: 100%;\r\nmargin: 0;\r\npadding: 0;\r\n}\r\n.horizontal-menu li {\r\ndisplay: block;\r\nflex: 0 1 auto;\r\nlist-style-type: none;\r\n}<\/pre>\n<p>If you&rsquo;d like to further style the menu you can change the color, font and size like so:<\/p>\n<pre>.horizontal-menu li {\r\ncolor: #000;\r\nfont-family: 'Roboto';\r\nfont-size: 16px;\r\n}\r\n<\/pre>\n<p>Finally, you can change the active menu item&rsquo;s color like this:<\/p>\n<pre>.boldgrid-shortcode.horizontal-menu .widget li.current-menu-item a {\r\ncolor: #FF0000;\r\n}\r\n<\/pre>\n<\/li>\n<li>The Customizer live preview will refresh to show the menu horizontally. Save and close the Customizer.<\/li>\n<li>The menu now appears horizontally on the front end of your website!<\/li>\n<\/ol>\n<p>Unfortunately at this time the Post and Page Builder will still show the menu vertically, as the code we just put in the Customizer is only read on the front end of your site. You should use the gray <b>Preview Changes<\/b> button in the Publish meta box to see how the design actually looks on the page before clicking the <strong>Update <\/strong> button.<\/p>\n<h2 id=\"save-your-horizontal-menu-block\">Save Your Horizontal Menu Block<\/h2>\n<p>Now that you know how to create a horizontal navigation menu, it&rsquo;s time to save it for use on other pages or posts. Hover in the section with the menu, and click the hamburger menu button at the bottom of the section.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-26210\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/save-block.png\" alt=\"\" width=\"300\" height=\"280\"><\/p>\n<p>In the popup, give your block a name and save. Now it is saved to your <strong>Block Library<\/strong>! To access this block again, open the new page or post you want to add the menu to, and click the orange <strong>Add Block<\/strong> button below the page title \/ permalink.<\/p>\n<p><a href=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-14195\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-1024x611.png\" alt=\"Add BoldGrid Block\" width=\"1024\" height=\"611\" srcset=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-1024x611.png 1024w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-300x179.png 300w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-768x458.png 768w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-250x149.png 250w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-550x328.png 550w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-800x477.png 800w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-302x180.png 302w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-503x300.png 503w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3-838x500.png 838w, https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2018\/05\/new-block-3.png 1246w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>On the right side of the screen is a <strong>Types <\/strong>dropdown, the second option is your Block Library. Your new block is there waiting for you!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26228\" src=\"https:\/\/www.boldgrid.com\/support\/wp-content\/uploads\/2020\/08\/block-library.png\" alt=\"\" width=\"269\" height=\"194\"><\/p>\n<h2 id=\"test-wordpress-safely-in-the-cloud\">Test WordPress Safely in the Cloud!<\/h2>\n<p>If you have concerns about adding new content directly to your live site, you can use Cloud WordPress and Total Upkeep to work safely in the cloud. It&rsquo;s easy! Simply make a backup of your site and transfer to the cloud, make your changes and then transfer back.<\/p>\n<p>Anyone can create a <a href=\"https:\/\/www.boldgrid.com\/free-wordpress-sites-demo\/\">free WordPress website<\/a> in the cloud through BoldGrid Central. <a href=\"https:\/\/www.boldgrid.com\/central\/start-for-free\/total-upkeep\">Click here<\/a> to create a new WordPress website pre-installed with Total Upkeep, our <a href=\"https:\/\/www.boldgrid.com\/wordpress-backup-plugin\/\">WordPress backup plugin<\/a>.<\/p>\n<p>After your Cloud WordPress installation is ready, follow these step by step instructions to transfer your site:<\/p>\n<ol>\n<li>Add Total Upkeep to your live site by navigating to <b>Plugins &gt; Add New<\/b> and searching for <b>Total Upkeep<\/b>.<\/li>\n<li>Navigate to <b>Total Upkeep<\/b> &gt; <b>Transfers <\/b>and click the blue <b>Backup Site Now<\/b> button.<\/li>\n<li>In the popup make sure the <b>Files and Folders<\/b> and <b>Database are <\/b>set to Full Backup, then click the blue <b>Backup Site Now<\/b> button in the lower right to start the backup.<\/li>\n<li>After the backup is completed, navigate to <b>Total Upkeep<\/b> &gt; <b>Transfers &gt;<\/b> <b>Source <\/b>and click the gray <b>Get Download Link <\/b>button. Copy the link.<\/li>\n<li>Change to the Cloud WordPress installation. Navigate to <b>Total Upkeep<\/b> &gt; <b>Transfers &gt;<\/b> <b>Destination, <\/b>paste the transfer link, and click the gray <b>Upload<\/b> button.<\/li>\n<li>After the backup is uploaded, click the gray <b>Restore <\/b>button.<\/li>\n<\/ol>\n<p>Now is the time to make changes! A Cloud WordPress installation is a great way to experiment with custom HTML and CSS. If something goes wrong you can restore the backup and start again right from Cloud WordPress.<\/p>\n<p>If the ENTIRE site breaks, you can go to <a href=\"https:\/\/www.boldgrid.com\/central\/cloud-wordpress\">BoldGrid Central<\/a> and delete the installation. Then, click the same link above to spin up a fresh WordPress site. Now only minutes have passed and you are ready to transfer your site and try again!<\/p>\n<p>When your updates are completed, create a new backup, copy the transfer link and upload the backup to your live site. After restoring the backup your website will show the new changes. We also have additional information on <a href=\"https:\/\/www.boldgrid.com\/support\/total-upkeep\/using-total-upkeep-to-migrate-wordpress-for-staging\/\">how to transfer a website<\/a> if needed.<\/p>\n<h2 id=\"horizontal-navigation-menus-in-twenty-twenty-one\">Horizontal Navigation Menus in Twenty Twenty-One<\/h2>\n<p>This can also be done if you are using Twenty-Twenty One, the current WordPress Core default theme. The code below will change all navigation menus located in the <strong>Customizer &gt; Widgets &gt; Footer<\/strong> section.<\/p>\n<pre>.widget-area .widget &gt; nav &gt; ul {\r\ndisplay: flex;\r\nalign-items: stretch;\r\njustify-content: space-between;\r\nwidth: 100%;\r\nmargin: 0;\r\npadding: 0;\r\n}\r\n<\/pre>\n<p>Please note that when we say all navigation menus, we mean <strong>ALL<\/strong>. The list below details which widgets are actually navigation menus, along with the code needed to control each one.<\/p>\n<div class=\"row\">\n<div class=\"col-md-6 col-sm-6 col-xs-12\">\n<ul>\n<li>Archives &ndash; widget_archive<\/li>\n<li>Categories &ndash; widget_categories<\/li>\n<li>Meta &ndash; widget_meta<\/li>\n<li>Navigation Menu &ndash; widget_nav_menu<\/li>\n<\/ul>\n<\/div>\n<div class=\"col-md-6 col-sm-6 col-xs-12\">\n<ul>\n<li>Pages &ndash; widget_pages<\/li>\n<li>Recent Comments &ndash; widget_recent_comments<\/li>\n<li>Recent Posts &ndash; widget_recent_entries<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p>Now you can choose which footer menus you want to display horizontally by replacing <code>.widget<\/code> in the provided code with your desired element. For example, this changes only the Categories widget:<\/p>\n<pre>.widget-area .widget_categories &gt; nav &gt; ul {\r\ndisplay: flex;\r\nalign-items: stretch;\r\njustify-content: space-between;\r\nwidth: 100%;\r\nmargin: 0;\r\npadding: 0;\r\n}\r\n<\/pre>\n<p>You can change multiple widget menus at once by adding a comma between each one. Keep stringing the widgets together until you&rsquo;ve achieved your desired design. In the example below, both the Categories and Navigation Menu widgets will be horizontal:<\/p>\n<pre>.widget-area .widget_categories &gt; nav &gt; ul,\r\n.widget-area .widget_nav_menu &gt; nav &gt; ul {\r\ndisplay: flex;\r\nalign-items: stretch;\r\njustify-content: space-between;\r\nwidth: 100%;\r\nmargin: 0;\r\npadding: 0;\r\n}\r\n<\/pre>\n<p>Congratulations! Now you can create a horizontal navigation menu in WordPress. We hope you found this article helpful, if you have any questions please let us know below!<\/p>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you may want a menu to appear horizontally on your website instead of vertically. Using the Post and Page Builder, our WordPress page builder plugin, and some simple CSS it&rsquo;s easy to create a horizontal navigation menu and save as a block for use across multiple pages. This article also provides the CSS needed [&hellip;]<\/p>\n","protected":false},"author":215,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"bgseo_title":"How to Create a Horizontal Navigation Menu in WordPress","bgseo_description":"Sometimes you may want a menu to appear horizontally on your website instead of vertically. Using the core Navigation Menu Widget and some simple CSS, it\u2019s easy to create a horizontal navigation menu and save as a block for use across multiple pages.","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[151],"tags":[],"class_list":["post-26211","post","type-post","status-publish","format-standard","hentry","category-wordpress-tutorials"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/26211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/users\/215"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/comments?post=26211"}],"version-history":[{"count":21,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/26211\/revisions"}],"predecessor-version":[{"id":122526,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/26211\/revisions\/122526"}],"wp:attachment":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/media?parent=26211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/categories?post=26211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/tags?post=26211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}