Jump to content

Hidden header navigation links continue to affect the layout of visible links!

Go to solution Solved by Ziggy,

Recommended Posts

Posted

i am using this bit of code to hide some header navigation links: 

<style>
  .header-nav-item--collection
a[href="/1"],
a[href="/2"],
a[href="/3"]{
    display: none !important;
}
</style>

Two of the links behave well but for whatever reason one of them, i am not sure which, behaves as if i was using the command visibility: hidden and messes up the layout of the header navigation links. Can i do something about this? Any help would be greatly appreciated! (My site is not live yet.)

  • Replies 3
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

Firstly can you share your website URL so I can see how the layout messes up?

The way you are targeting the links is different; the first one is targeted with:

.header-nav-item--collection a[href="/1"]

the second with:

a[href="/2"]

 and the third:

a[href="/3"]

You can tell this from the brackets and commas. This may explain why they are acting differently.

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

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

📈 SEO Space (Referral link)
Ⓜ️ 
Will Myers' Plugins & Tutorials (Referral link)
 🔌 Ghost Squarespace Plugins (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

  • Solution
Posted

Although it is often better to target the link with the URL, you won't be able to get rid of the container that way, try using this to target the first 3 items (or chose any other numbers):

.header-nav-item:nth-child(1) {
  display:none;
}
.header-nav-item:nth-child(2) {
  display:none;
}
.header-nav-item:nth-child(3) {
  display:none;
}

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

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

📈 SEO Space (Referral link)
Ⓜ️ 
Will Myers' Plugins & Tutorials (Referral link)
 🔌 Ghost Squarespace Plugins (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Posted

thank you. for the desperate: this codes hides 1, 2 and 3 and displays 4, 5 and 6 (i have 6 header navigation links):

<style>
  .header-nav-item--collection {
    display: none !important; /* Hide all navigation items by default */
  }
  .header-nav-item--collection:nth-child(4),
  .header-nav-item--collection:nth-child(5),
  .header-nav-item--collection:nth-child(6) {
    display: inline-block !important; /* Display the specific items you want to show */
  }
</style>

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.