tymon Posted September 29, 2023 Share Posted September 29, 2023 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.) Link to comment
Ziggy Posted September 29, 2023 Share Posted September 29, 2023 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! 🔌 Ghost Squarespace Plugins (Referral link) 📈 SEO Space (Referral link) ⬛ SquareWebsites Plugins (Referral link) 🔲 SQSP Themes (Referral link) ✨ Spark Plugin (Referral link) 🖼️ Gallery Lightbox Plugin (Referral link) ☕ Did I help? Buy me a coffee? Link to comment
Solution Ziggy Posted September 29, 2023 Solution Share Posted September 29, 2023 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! 🔌 Ghost Squarespace Plugins (Referral link) 📈 SEO Space (Referral link) ⬛ SquareWebsites Plugins (Referral link) 🔲 SQSP Themes (Referral link) ✨ Spark Plugin (Referral link) 🖼️ Gallery Lightbox Plugin (Referral link) ☕ Did I help? Buy me a coffee? Link to comment
tymon Posted September 29, 2023 Author Share Posted September 29, 2023 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> Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment