Jump to content

Navigation bar - Change font size dynamically or convert to hamburger menu according to browser window size

Recommended Posts

Hello there! I'm building a website where the navigation is long and it folds down to the second line when I reduce the window size on a desktop. Is there a way to dynamically change the font size according to the window size or shrink it to a hamburger menu when it goes beyond a certain size? 

Thanks a ton in advance.

Link to comment

There are ways to improve that with a dynamic font sizes, can you share your website URL?

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 

  Did I help? Buy me a coffee?

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

Link to comment

Try this Custom CSS:

@media only screen and (min-width:768px) and (max-width:1350px) {
  .header-nav-item {
    font-size: 1.2vw;
  }
}

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 

  Did I help? Buy me a coffee?

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

Link to comment

Did you try adjusting the font size value? The 1.2vw seemed to work for me in testing, but that's never the same as actually installing it and testing it.

Honestly, the best way to prevent that from happing is to reduce the size of your logo, either universally or with a little code:

@media only screen and (max-width:1250px) {
  .header-title-logo {
    max-width: 35vw;
  }
}

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 

  Did I help? Buy me a coffee?

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

Link to comment

This reduces the logo size, however, it doesn't do it dynamically. When the window size decreases to a specific extent it reduces the size of the logo. I think it can be handled by a few lines of code to handle different sizes. 

But which parameter represents the length and width of the window and which parameter represents the size of the logo?

Thanks again!

Link to comment

I set the maximum width that the dynamic logo code applies to, to 1250px, you can play with increasing this value to 1400px or higher, see what works.

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 

  Did I help? Buy me a coffee?

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.