All Posts
-
min read

Custom Menu Breakpoints in Webflow: A Step-by-Step Guide

Published on
April 25, 2024

As web designers at Polar Hedgehog, we often encounter challenges when building websites with navigation bars that contain numerous links and buttons. One common issue is the poor display of these elements on smaller screens, where they appear disjointed and break apart, compromising the overall visual appeal and usability of the site.

Site: foundational.io

To address this problem, our team at Polar Hedgehog has developed a solution that involves displaying the burger menu, a common design pattern for navigation on tablet and mobile devices, at a screen width earlier than the default 991px breakpoint by using custom code within Webflow. However, simply making the burger menu appear isn't sufficient, as its styling is set to start at 991px.

Therefore, in addition to activating the burger menu earlier, we need to include specific styling within the code to ensure a seamless and visually appealing experience. In the following sections of this guide, we'll walk you through the process of locating and implementing this styling, empowering you to create responsive and user-friendly navigation bars for your Webflow projects.

Step 1: Add the Custom Script to Your Website

To implement the custom burger menu breakpoint, you'll need to add a script to your Webflow project. If you want the custom breakpoint to be applied throughout your entire website, navigate to your Website's Settings in Webflow and paste the following script: 

<!-- Menu Collapse Breakpoint -->
<style>
@media screen and (max-width: 1360px) {
.w-nav[data-collapse="medium"] .w-nav-menu {
display: none;
}
.w-nav[data-collapse="medium"] .w-nav-button {
display: block;
}
/* All Menu Styling Paste Here */
}
</style>

Make sure to adjust the max-width value (in this example, 1360px) to your desired breakpoint width. This value determines the screen width at which the burger menu will appear.

Alternatively, if you prefer to apply the custom breakpoint only to a specific page, navigate to that Page's Settings in Webflow and paste the same script there.

Once you've added the script, the burger menu will be displayed at the specified breakpoint. However, to ensure that the menu styling is consistent with the rest of your design, you'll need to include additional styling rules within the /* All Menu Styling Paste Here */ comment in the script. We'll cover this in the next step.

Step 2: Locate Your Navbar Styling for Tablet

To ensure a consistent and visually appealing burger menu at your custom breakpoint, you don't need to write the styling from scratch. Instead, locate the existing styles you've created for the tablet breakpoint and apply them to your custom breakpoint:

  1. Open your published Webflow site and launch the browser's developer tools by right-clicking and selecting "Inspect" or using the appropriate keyboard shortcut.
  2. In the developer tools, navigate to the "Network" tab, locate the CSS file associated with your website, and open it in the "Sources" panel.

3. Use the search functionality (Cmd+F on macOS or Ctrl+F on Windows) to find "max-width: 991px", which is commonly used for tablet styles in Webflow. The third search result usually contains all the styling classes for this screen size.

4. Carefully go through the classes, identify the ones related to your navbar (they may be unordered and distributed throughout the list), and copy the relevant styles, including all necessary classes and properties.

Once you've located and copied the navbar styles for the tablet breakpoint, you'll be ready to paste them into the custom script you added in Step 1, ensuring your burger menu appears at the desired breakpoint with the appropriate styling.

Step 3: Add Styling to Script

Now that you've located and copied the navbar styles for the tablet breakpoint, it's time to add them to the custom script in Webflow. You have two options for adding the styles, depending on your preference and workflow:

Option 1: Copy styles one by one

  1. Open the custom script you added in Step 1 in Webflow's Website Settings or Page Settings.
  2. Locate the `/* All Menu Styling Paste Here */` comment within the script.
  3. Paste the copied navbar styles below this comment, one style at a time, ensuring that each style is placed within the `@media` query and the `<style>` tags.
  4. Review the pasted styles to ensure they are correctly formatted and free of any syntax errors.

Option 2: Copy all styles at once

  1. Open the custom script you added in Step 1 in Webflow's Website Settings or Page Settings.
  2. Locate the `/* All Menu Styling Paste Here */` comment within the script.
  3. Paste all the copied navbar styles below this comment, ensuring they are within the `@media` query and the `<style>` tags.
  4. Review the pasted styles and delete any non-relevant or duplicate styles directly in Webflow to clean up the code.

After adding the styles using either option, save your changes and publish your website. Your custom burger menu breakpoint should now be fully functional, displaying the burger menu at the specified screen width with the appropriate styling.

By following these steps, you'll have successfully implemented a custom burger menu breakpoint in your Webflow project, enhancing the responsiveness and user experience of your website's navigation.

Conclusion

Implementing a custom burger menu breakpoint in Webflow is a powerful way to enhance the responsiveness and user experience of your website's navigation. By following this step-by-step guide, you'll be able to add a custom script to your Webflow project, locate the existing navbar styles for the tablet breakpoint, and seamlessly integrate them into your custom breakpoint.

At Polar Hedgehog, our team of experienced web designers understands the importance of creating websites that are both visually appealing and user-friendly across all devices. By utilizing custom code and leveraging Webflow's built-in responsive design features, we can create tailored solutions that meet the unique needs of our clients and their target audiences.

We hope this guide has provided you with valuable insights and practical knowledge on how to implement custom burger menu breakpoints in your own Webflow projects. By mastering these techniques, you'll be well-equipped to create responsive, engaging, and professional websites that leave a lasting impression on your users.

Contributors

Omer Hoffman
Web Design Team Lead
Natalia Kovalenko
Web Designer

Join our newsletter