{"id":7608,"date":"2021-07-02T01:15:13","date_gmt":"2021-07-02T01:15:13","guid":{"rendered":"https:\/\/readyship.co\/blog\/?p=7608"},"modified":"2021-07-02T01:15:15","modified_gmt":"2021-07-02T01:15:15","slug":"add-button-menu-wordpress-css","status":"publish","type":"post","link":"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/","title":{"rendered":"How to Add a Button to Menu in WordPress with CSS (Examples Included)"},"content":{"rendered":"\n<p>Usually, menu items are just simple text links, nothing fancy. Some <a href=\"https:\/\/readyship.co\/blog\/find-wordpress-themes\/\">WordPress themes<\/a> provide a feature to add a button to your WordPress menu, but there are not that many. And those that allow you to do so are usually heavy, feature-rich themes, which you should avoid because they can impact your website&#8217;s loading time.<\/p>\n\n\n\n<p>So, what can you do if you want to add a button to your WordPress menu to attract more attention  and generate more clicks to a certain area of your website?<\/p>\n\n\n\n<p>Well, you could use a plugin. But installing yet another plugin adds more bloat, potentially leading to other issues regarding loading time, optimization, security, and so on. I always say that the fewer plugins you have, the better!<\/p>\n\n\n\n<p>So, what&#8217;s there left to do? Well, you can use some simple CSS code that you can easily add to your WordPress website. That&#8217;s what I&#8217;ll show you in this step-by-step tutorial.<\/p>\n\n\n\n<p>Let&#8217;s get started!<\/p>\n\n\n\n<div class=\"wp-block-group rs-toc\"><div class=\"wp-block-group__inner-container\">\n<p><strong>Contents<\/strong><\/p>\n\n\n\n<ol><li><a href=\"#advantage\">The Advantage of Having a Button in Your WordPress Menu<\/a><\/li><li><a href=\"#add-button-menu\">How to Add a Button to Your Menu in WordPress with CSS<\/a><\/li><li><a href=\"#css-buttons\">More Types of CSS Buttons for Your WordPress Menu<\/a><\/li><li><a href=\"#remove-button-mobile\">Remove the Button from the WordPress Menu on Mobile Devices<\/a><\/li><\/ol>\n<\/div><\/div>\n\n\n\n<h2 id=\"advantage\">The Advantage of Having a Button in Your WordPress Menu<\/h2>\n\n\n\n<p>Before getting to the main point, let me tell you the main reason why adding a button to your WordPress menu can be a good idea.<\/p>\n\n\n\n<p>The reason is &#8220;Conversions&#8221;. Maybe you want visitors to create an account, or buy a product, or visit a certain page.<\/p>\n\n\n\n<p>Transforming a simple text link from your menu into a button can help with that because it draws more attention. It stands out and visitors notice it more easily.<\/p>\n\n\n\n<p>And if it&#8217;s noticed more easily, it means that more visitors will click on it, improving your <a href=\"https:\/\/en.wikipedia.org\/wiki\/Click-through_rate\">CTR (Click-through rate)<\/a>. And getting more clicks means that you get more chances of conversion.<\/p>\n\n\n\n<p>Let&#8217;s see a couple of examples of websites that currently have a button in their menu.<\/p>\n\n\n\n<p>The first one is <a href=\"https:\/\/medium.com\/\">Medium<\/a>, which is a popular online publishing platform.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"593\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/medium-menu-button.png\" alt=\"medium\" class=\"wp-image-7613\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/medium-menu-button.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/medium-menu-button-300x212.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/medium-menu-button-768x542.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>As you can see, they have the <strong>Get started<\/strong> menu link turned into a button. That&#8217;s because their main goal is to get as many people to sign up to use their platform.<\/p>\n\n\n\n<p>The second example is the <a href=\"https:\/\/wpastra.com\/\">Astra theme<\/a>, which is a popular WordPress theme.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"596\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/astra-theme.jpg\" alt=\"astra theme\" class=\"wp-image-7615\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/astra-theme.jpg 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/astra-theme-300x213.jpg 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/astra-theme-768x545.jpg 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>As you can see, they have a <strong>Download<\/strong> button in their menu. The button directs visitors to the Pricing page, where there&#8217;s a <a href=\"https:\/\/readyship.co\/blog\/best-free-wordpress-pricing-table-plugins\/\">pricing table<\/a> with plans and their features.<\/p>\n\n\n\n<div class=\"wp-block-group rs-cta has-background\" style=\"background-color:#fafaff\"><div class=\"wp-block-group__inner-container\">\n<p class=\"has-large-font-size\">Looking to Buy or Sell WordPress Sites?<\/p>\n\n\n\n<p>At ReadyShip, we offer an all-in-one WordPress solution for those looking to start a blog or site, as well as the opportunity for WordPress developers or professionals to sell their products!<\/p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"https:\/\/readyship.co\/products\">Browse Sites<\/a><\/div>\n\n\n\n<div class=\"wp-block-button is-style-outline\"><a class=\"wp-block-button__link\" href=\"https:\/\/readyship.co\/blog\/start-selling\/\">Start Selling<\/a><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<h2 id=\"add-button-menu\">How to Add a Button to Your Menu in WordPress with CSS<\/h2>\n\n\n\n<p>After seeing the advantage of having a button in your WordPress menu, let&#8217;s see how you can add one with CSS. <\/p>\n\n\n\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Learn\/CSS\/First_steps\/What_is_CSS\">CSS<\/a> stands for &#8220;Cascading Style Sheets&#8221;. It&#8217;s a web development language that handles the design of a website, such as fonts, colors, layouts, and so on.<\/p>\n\n\n\n<p>I&#8217;ll use that to transform a simple text link from the WordPress menu into a button. Because you won&#8217;t create a button somewhere else and add it there. You just need to style an existing text link. That&#8217;s how it&#8217;s done.<\/p>\n\n\n\n<p>So, roll up your sleeves, and let&#8217;s get to work. \ud83d\ude00<\/p>\n\n\n\n<h3>Step 1<\/h3>\n\n\n\n<p>From your WordPress dashboard&#8217;s menu, go to <strong>Appearance<\/strong> &gt; <strong>Menu<\/strong>. <\/p>\n\n\n\n<p>Then, from the top right, bring down the <strong>Screen Options<\/strong> to enable the <strong>CSS Classes<\/strong> option by checking the box next to it.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"291\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/enable-css-class-wordpress-menu.png\" alt=\"enable css classes in wordpress menu\" class=\"wp-image-7619\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/enable-css-class-wordpress-menu.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/enable-css-class-wordpress-menu-300x104.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/enable-css-class-wordpress-menu-768x266.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<h3>Step 2<\/h3>\n\n\n\n<p>Click on the menu item&#8217;s arrow to bring up more options. You&#8217;ll see a <strong>CSS Classes<\/strong> field.<\/p>\n\n\n\n<p>Add a <strong>hyphenated, descriptive, and unique name<\/strong> for the CSS class. It needs to be unique so it won&#8217;t potentially conflict with another class from your theme or a plugin.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"779\" height=\"630\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-class-menu-item-wordpress.png\" alt=\"add css class to menu item in wordpress\" class=\"wp-image-7621\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-class-menu-item-wordpress.png 779w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-class-menu-item-wordpress-300x243.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-class-menu-item-wordpress-768x621.png 768w\" sizes=\"(max-width: 779px) 100vw, 779px\" \/><\/figure><\/div>\n\n\n\n<p>In my example, I named my CSS class <code>my-custom-menu-button<\/code>. I&#8217;m pretty sure that no WordPress developer will name a CSS class like that. \ud83d\ude42 So, there&#8217;s no potential conflict with other CSS code.<\/p>\n\n\n\n<h3>Step 3<\/h3>\n\n\n\n<p>Copy the CSS class that you added. Then, open up the WordPress customizer by going to <strong>Appearance<\/strong> &gt; <strong>Customize<\/strong> &gt; <strong>Additional CSS<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"342\" height=\"568\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/wordpress-add-additional-css.png\" alt=\"additional css wordpress\" class=\"wp-image-7624\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/wordpress-add-additional-css.png 342w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/wordpress-add-additional-css-181x300.png 181w\" sizes=\"(max-width: 342px) 100vw, 342px\" \/><\/figure><\/div>\n\n\n\n<p>Some themes or plugins might rename it or even add it in another place. What I showed you is the default location and name.<\/p>\n\n\n\n<p>There are <a href=\"https:\/\/readyship.co\/blog\/add-custom-css-wordpress\/\">other ways to add custom CSS to WordPress<\/a>, but this is the easiest way.<\/p>\n\n\n\n<h3>Step 4<\/h3>\n\n\n\n<p>Now, I&#8217;ll show you what CSS code I used to create a button in my WordPress menu. Then, I&#8217;ll break it down a bit so you can understand it better.<\/p>\n\n\n\n<p>This is the CSS code that I added to transform my <strong>Download<\/strong> menu link into a button.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Adding button to menu *\/\n.my-custom-menu-button {\n\tbackground-color: #ff0000;\t\n}\n\n.my-custom-menu-button a, .my-custom-menu-button a:hover, .my-custom-menu-button a:active {\n\tcolor: #ffffff !important;\n}\n\n.my-custom-menu-button:hover {\n\tbackground-color: #FF4D4D;\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"279\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-button-wordpress-menu-css-2.png\" alt=\"add button to wordpress menu with css\" class=\"wp-image-7636\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-button-wordpress-menu-css-2.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-button-wordpress-menu-css-2-300x100.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-button-wordpress-menu-css-2-768x255.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>Now, let&#8217;s break it down a bit.<\/p>\n\n\n\n<p><code>\/* Adding button to menu *\/<\/code><\/p>\n\n\n\n<p>This is just a comment so that, in the future, I know what the code is for. You should always comment on your code because you&#8217;ll forget what&#8217;s it for, trust me.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.my-custom-menu-button {\n\tbackground-color: #ff0000;\t\n}<\/code><\/pre>\n\n\n\n<p>The first thing I want to point here is that I added a dot (<code>.<\/code>) before the CSS class that I created at step 2, like this: <code>.my-custom-menu-button<\/code>. That&#8217;s mandatory for CSS classes, so always add a dot before.<\/p>\n\n\n\n<p>The declarations with properties and values go between curly brackets <code>{ }<\/code>.<\/p>\n\n\n\n<p>The <code>background-color<\/code> is set to <code>#ff0000<\/code>, which is the hex code for the color red. This makes the button have a red background. <\/p>\n\n\n\n<p>You can select colors and <a href=\"https:\/\/htmlcolorcodes.com\/\">generate hex codes using this free web tool<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"532\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/generate-dex-code.png\" alt=\"generate hex color\" class=\"wp-image-7631\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/generate-dex-code.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/generate-dex-code-300x190.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/generate-dex-code-768x486.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>.my-custom-menu-button a, .my-custom-menu-button a:hover, .my-custom-menu-button a:active {\n\tcolor: #ffffff !important;\n}<\/code><\/pre>\n\n\n\n<p>This part of the code changes the link&#8217;s color inside the button. Since black text on a red background doesn&#8217;t look so good, I made it white.<\/p>\n\n\n\n<p>I also made the link stay white on hover and when it&#8217;s active, meaning when that particular web page is opened.<\/p>\n\n\n\n<p>The color wouldn&#8217;t change to white on hover. This usually means that another CSS declaration was declared after mine, therefore overriding it.<\/p>\n\n\n\n<p>So, I added <code>!important<\/code> to override all previous styling rules.<\/p>\n\n\n\n<p>Alternatively, I could have been more specific by adding WordPress&#8217; <code>.main-navigation<\/code> CSS class before each <code>.my-custom-menu-button<\/code> class, like this <code>.main-navigation .my-custom-menu-button a<\/code>. I wouldn&#8217;t need to add <code>!important<\/code> then.<\/p>\n\n\n\n<p>But that default WordPress class might change, or you might want to add a button to your footer menu, for example. So, to make things easier for you, I added <code>!important<\/code> instead. <\/p>\n\n\n\n<p>You can try without it to see if it works for you.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.my-custom-menu-button:hover {\n\tbackground-color: #FF4D4D;\n}<\/code><\/pre>\n\n\n\n<p>The last part of the CSS code changes the button&#8217;s background color on hover. That way, the users can easily see that they&#8217;re hovering over it.<\/p>\n\n\n\n<div class=\"wp-block-group rs-cta has-background\" style=\"background-color:#fafaff\"><div class=\"wp-block-group__inner-container\">\n<p class=\"has-large-font-size\"><strong>Looking for an All-in-One WordPress Solution?<\/strong><\/p>\n\n\n\n<p>ReadyShip offers you ready-made WordPress sites and blogs, plus high-quality managed AWS hosting with free SSL and CDN, at <strong>no initial cost!<\/strong><\/p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"https:\/\/readyship.co\/products\">Visit Marketplace<\/a><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<h2 id=\"css-buttons\">More Types of CSS Buttons for Your WordPress Menu<\/h2>\n\n\n\n<p>What I previously showed you is a standard type of button that you can add to your menu in WordPress. Let&#8217;s see some CSS code for other types of buttons that you can create.<\/p>\n\n\n\n<h3>Pill button<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"300\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-pill-button-wordpress-menu.png\" alt=\"add pill button to wordpress menu with css\" class=\"wp-image-7639\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-pill-button-wordpress-menu.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-pill-button-wordpress-menu-300x107.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-pill-button-wordpress-menu-768x274.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>A pill button is a button that&#8217;s rounded. Here&#8217;s the code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Adding pill button to menu *\/\n.my-custom-menu-button {\n\tbackground-color: #ff0000;\n\tborder-radius: 26px;\n}\n\n.my-custom-menu-button a, .my-custom-menu-button a:hover, .my-custom-menu-button a:active {\n\tcolor: #ffffff !important;\n}\n\n.my-custom-menu-button:hover {\n\tbackground-color: #FF4D4D;\n}<\/code><\/pre>\n\n\n\n<p> The only difference is here:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.my-custom-menu-button {\n\tbackground-color: #ff0000;\n\tborder-radius: 26px;\n}<\/code><\/pre>\n\n\n\n<p>I added a <code>border-radius<\/code> with a value of <code>26px<\/code> (px = pixels). You can change that value to whatever you like. For example 5px, 16px, 20px, 32px, etc.<\/p>\n\n\n\n<h3>Outline button<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"286\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-outline-button-wordpress-menu-css.png\" alt=\"add outlinebutton to wordpress menu with css\" class=\"wp-image-7641\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-outline-button-wordpress-menu-css.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-outline-button-wordpress-menu-css-300x102.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-outline-button-wordpress-menu-css-768x261.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>An outline button only has a border. The background color is usually added on hover. <\/p>\n\n\n\n<p>Here&#8217;s the code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Adding outline button to menu *\/\n.my-custom-menu-button a {\n\tborder: 2px solid #222;\n}\n\n.my-custom-menu-button a:hover {\n\tbackground-color: #ff0000;\n\tborder: 2px solid #ff0000;\n}\n\n.my-custom-menu-button a:hover, .my-custom-menu-button a:active {\n\tcolor: #fff !important;\n}<\/code><\/pre>\n\n\n\n<p>This one has more modifications:<\/p>\n\n\n\n<ol><li>I added a black border with a transparent background;<\/li><li>Then, on hover, I added a red background with a red border that&#8217;s equal to the initial one. This makes all the button red on hover;<\/li><li>I changed the link color to white, on hover, when the button turns red.<\/li><\/ol>\n\n\n\n<h3>Rounded outline button<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"303\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-rounded-outline-button-wordpress-menu-css.png\" alt=\"add outlinebutton to wordpress menu with css\" class=\"wp-image-7645\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-rounded-outline-button-wordpress-menu-css.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-rounded-outline-button-wordpress-menu-css-300x108.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/add-rounded-outline-button-wordpress-menu-css-768x277.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>To make an outline button rounded, you only need to add a <code>border-radius<\/code>, as you&#8217;ve seen in the pill button example.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Adding rounded outline button to menu *\/\n.my-custom-menu-button a {\n\tborder: 2px solid #222;\n\tborder-radius: 26px;\n}\n\n.my-custom-menu-button a:hover {\n\tbackground-color: #ff0000;\n\tborder: 2px solid #ff0000;\n}\n\n.my-custom-menu-button a:hover, .my-custom-menu-button a:active {\n\tcolor: #fff !important;\n}<\/code><\/pre>\n\n\n\n<h2 id=\"remove-button-mobile\">Remove the Button from the WordPress Menu on Mobile Devices<\/h2>\n\n\n\n<p>Usually, on mobile devices, the menu items are collapsed into a hamburger menu or something like that. So, the menu items are revealed vertically on screen tap. <\/p>\n\n\n\n<p>Therefore, you might not want a button in there, especially if it doesn&#8217;t look good and more CSS code is needed to style it.<\/p>\n\n\n\n<p>If that&#8217;s the case, you can wrap one of the above CSS codes in a media query:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@media only screen and (max-width: 1024px) { }<\/code><\/pre>\n\n\n\n<p>So, the CSS code for the WordPress menu button should look like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* Adding button to menu - mobile devices excluded *\/\n@media only screen and (min-width: 1024px) { \t\n\t.my-custom-menu-button {\n\t\tbackground-color: #ff0000;\t\n\t}\n\n\t.my-custom-menu-button a, .my-custom-menu-button a:hover, .my-custom-menu-button a:active {\n\t\tcolor: #ffffff !important;\n\t}\n\n\t.my-custom-menu-button:hover {\n\t\tbackground-color: #FF4D4D;\n\t}\n}<\/code><\/pre>\n\n\n\n<p>This only shows the button in your WordPress menu when the viewport is over 1024px (px = pixels), which usually means screens bigger than tablets on landscape mode.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" width=\"840\" height=\"343\" src=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/remove-wordpress-button-menu-mobile.png\" alt=\"css code to remove menu button from wordpress on mobile devices\" class=\"wp-image-7647\" srcset=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/remove-wordpress-button-menu-mobile.png 840w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/remove-wordpress-button-menu-mobile-300x123.png 300w, https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/remove-wordpress-button-menu-mobile-768x314.png 768w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><\/div>\n\n\n\n<p>As you can see from my screenshot, the viewport is under 1024 pixels, so my menu collapsed. It now reveals the menu items when the <strong>Menu<\/strong> button is tapped.<\/p>\n\n\n\n<p>And, as you can notice, the Download menu item is not shown as a button. It&#8217;s just plain text as the others.<\/p>\n\n\n\n<div class=\"wp-block-group rs-cta has-background\" style=\"background-color:#fafaff\"><div class=\"wp-block-group__inner-container\">\n<p class=\"has-large-font-size\"><strong>Looking for an All-in-One WordPress Solution?<\/strong><\/p>\n\n\n\n<p>ReadyShip offers you ready-made WordPress sites and blogs, plus high-quality managed AWS hosting with free SSL and CDN, at <strong>no initial cost!<\/strong><\/p>\n\n\n\n<div class=\"wp-block-buttons\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" href=\"https:\/\/readyship.co\/products\">Visit Marketplace<\/a><\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<h2>The End<\/h2>\n\n\n\n<p>I hope that the tutorial was comprehensive enough, and you managed to add a button to your menu in WordPress with CSS. <\/p>\n\n\n\n<p>It&#8217;s a pretty easy solution that saves you from adding yet another plugin to the pile.<\/p>\n\n\n\n<p>If you need help, have questions or thoughts, please feel free to leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually, menu items are just simple text links, nothing fancy. Some WordPress themes provide a feature to add a button to your WordPress menu, but there are not that many. And those that allow you to do so are usually heavy, feature-rich themes, which you should avoid because they can impact your website&#8217;s loading time. So, what can you do if you want to add a button to your WordPress menu to attract more attention and generate more clicks to a certain area of your website? Well, you could use a plugin. But installing yet another plugin adds more bloat, potentially leading to other issues regarding loading time, optimization, security, [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":7652,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"kt_blocks_editor_width":""},"categories":[18],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Add a Button to Menu in WordPress with CSS (Examples Included) : Ready-Made WordPress Marketplace - ReadyShip<\/title>\n<meta name=\"description\" content=\"A step-by-step tutorial on how to add a button to your WordPress menu without a plugin, only simple CSS code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add a Button to Menu in WordPress with CSS (Examples Included) : Ready-Made WordPress Marketplace - ReadyShip\" \/>\n<meta property=\"og:description\" content=\"A step-by-step tutorial on how to add a button to your WordPress menu without a plugin, only simple CSS code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/\" \/>\n<meta property=\"og:site_name\" content=\"Ready-Made WordPress Marketplace - ReadyShip\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ReadyShip\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-02T01:15:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-02T01:15:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/menu-button.png\" \/>\n\t<meta property=\"og:image:width\" content=\"980\" \/>\n\t<meta property=\"og:image:height\" content=\"551\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@readyshipco\" \/>\n<meta name=\"twitter:site\" content=\"@readyshipco\" \/>\n<meta name=\"twitter:label1\" value=\"Written by\">\n\t<meta name=\"twitter:data1\" value=\"Radu\">\n\t<meta name=\"twitter:label2\" value=\"Est. reading time\">\n\t<meta name=\"twitter:data2\" value=\"7 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/readyship.co\/blog\/#organization\",\"name\":\"Readyship\",\"url\":\"https:\/\/readyship.co\/blog\/\",\"sameAs\":[\"https:\/\/www.facebook.com\/ReadyShip\",\"https:\/\/twitter.com\/readyshipco\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/readyship.co\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2019\/01\/readyship_logo_icon.png\",\"width\":201,\"height\":201,\"caption\":\"Readyship\"},\"image\":{\"@id\":\"https:\/\/readyship.co\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/readyship.co\/blog\/#website\",\"url\":\"https:\/\/readyship.co\/blog\/\",\"name\":\"Readship: WordPress Websites with the Best Hosting\",\"description\":\"Buy\/Sell Subscription Marketplace of beautiful designed WordPress sites with managed hosting, SSL, CDN, 24\/7 supports.\",\"publisher\":{\"@id\":\"https:\/\/readyship.co\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/readyship.co\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/readyship.co\/blog\/wp-content\/uploads\/2021\/06\/menu-button.png\",\"width\":980,\"height\":551,\"caption\":\"menu button\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#webpage\",\"url\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/\",\"name\":\"How to Add a Button to Menu in WordPress with CSS (Examples Included) : Ready-Made WordPress Marketplace - ReadyShip\",\"isPartOf\":{\"@id\":\"https:\/\/readyship.co\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#primaryimage\"},\"datePublished\":\"2021-07-02T01:15:13+00:00\",\"dateModified\":\"2021-07-02T01:15:15+00:00\",\"description\":\"A step-by-step tutorial on how to add a button to your WordPress menu without a plugin, only simple CSS code.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/\"]}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#webpage\"},\"author\":{\"@id\":\"https:\/\/readyship.co\/blog\/#\/schema\/person\/092d749a9bb9e9cb2af8f2532d8e5b45\"},\"headline\":\"How to Add a Button to Menu in WordPress with CSS (Examples Included)\",\"datePublished\":\"2021-07-02T01:15:13+00:00\",\"dateModified\":\"2021-07-02T01:15:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/readyship.co\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#primaryimage\"},\"articleSection\":\"WordPress Tutorials\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/readyship.co\/blog\/add-button-menu-wordpress-css\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/readyship.co\/blog\/#\/schema\/person\/092d749a9bb9e9cb2af8f2532d8e5b45\",\"name\":\"Radu\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/readyship.co\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fb19726677ad7e3b932bf8b0d9ac7094?s=96&d=mm&r=g\",\"caption\":\"Radu\"},\"description\":\"Hey! I'm Radu, and I've been working with WordPress at personal and professional levels for over 8 years now. I'm a seller on ReadyShip, and I'm also writing posts for their blog, which I hope you'll like. You can find more about me at Radu.link. I'm also quietly on Twitter @RaduWP.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/posts\/7608"}],"collection":[{"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/comments?post=7608"}],"version-history":[{"count":2,"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/posts\/7608\/revisions"}],"predecessor-version":[{"id":7671,"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/posts\/7608\/revisions\/7671"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/media\/7652"}],"wp:attachment":[{"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/media?parent=7608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/categories?post=7608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/readyship.co\/blog\/wp-json\/wp\/v2\/tags?post=7608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}