Jump to content

How do I target a specific link in the main menu with CSS?

Go to solution Solved by tuanphan,

Recommended Posts

  • designbyjrs changed the title to How do I target a specific link in the main menu with CSS?
  • Replies 6
  • Views 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

Add to Design > CUstom CSS

nav.header-nav-list>div:nth-child(1) a, .header-menu-nav-folder[data-folder="root"]>div>div:nth-child(1) a {
    color: #f1f !important;
}
nav.header-nav-list>div:nth-child(2) a .header-menu-nav-folder[data-folder="root"]>div>div:nth-child(2) a {
    color: red !important;
}
nav.header-nav-list>div:nth-child(3) a, .header-menu-nav-folder[data-folder="root"]>div>div:nth-child(3) a {
    color: green !important;
}
nav.header-nav-list>div:nth-child(4) a, .header-menu-nav-folder[data-folder="root"]>div>div:nth-child(4) a {
    color: brown !important;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 4 months later...
On 8/15/2023 at 3:10 AM, giorgiasage said:

hi @tuanphan, this solution worked great for creating faux-button styles for some of my links.

However, I want to target their outer container to use a flex-grow property to force a line break in the nav link flexbox. Is there a way to modify this code to do so?image.thumb.png.acc4d8e1c12bab7259b27c36f9267509.png

Which position you want to add line break? after Apply item or?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 6 months later...
On 3/5/2024 at 3:12 AM, hey_sp said:

Hi @tuanphan I think this is a similar issue. I have two buttons in my main nav and I want to just target one of them. Is there a way for me to change the background colour of just the "Match with a Therapist" button in my header nav?

https://goldfish-wrasse-48kn.squarespace.com/
password: igc

You can use this CSS code

#siteWrapper header#header a.btn:nth-child(2) {
    background-color: #f1f !important;
}

Note: this code will target both Button Header in Desktop + Mobile

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.