Jump to content

Trying to customize states of links in header

Go to solution Solved by ashleyev,

Recommended Posts

 Hey there! 

New to Squarespace and CSS. Here's my site: https://aardvark-tangerine-ncep.squarespace.com/config/

I want to customize my header links states to be...

  • Inactive: nothing
  • Hover: underline (or bottom border)
  • Active: underline (or bottom border)

Running into 2 problems:

  1. The active / hover effect underlines are different. (One came with template and one is my custom CSS, I prefer my customization).
  2. When a link is active AND I hover, it has 2 underline decorations. Only want to show one (active)

Can someone help me out 😄  Thanks in advance! Screenshot attached. CSS snippet below.

/* Apply "DM Sans" to paragraphs and headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}
/* Apply the custom font style to all Paragraph 1 blocks */
p {
    font-family: 'Mulish', sans-serif; /* Apply your desired font */
    /* Additional styling, such as font size, color, etc. */
}

/* Apply a hover effect to the button with the class "your-button-class" */
.your-button-class:hover {
    background-color: #ff6600; /* Change this to your desired hover background color */
    /* Additional styling, such as color, border, etc. */
}

/* Apply a custom font style to the header navigation links */
.header-nav-item {
    font-family:'DM Sans', sans-serif;
  font-weight: 500; 
    /* Additional styling, such as font size, color, etc. */
}
/* Apply an underline effect to the header navigation items on hover */
.header-nav-item:hover {
    text-decoration: underline; /* Add an underline on hover */
}
/* Apply an underline effect to inactive header navigation items on hover */
.header-nav-item:not(.header-nav-item--active):hover {
    text-decoration: underline; /* Add an underline on hover */
}

 

Screenshot 2023-10-20 at 2.52.17 PM.png

 

Edited by ashleyev
duplicate attachment
Link to comment
56 minutes ago, ashleyev said:

 Hey there! 

New to Squarespace and CSS. Here's my site: https://aardvark-tangerine-ncep.squarespace.com/config/

I want to customize my header links states to be...

  • Inactive: nothing
  • Hover: underline (or bottom border)
  • Active: underline (or bottom border)

Running into 2 problems:

  1. The active / hover effect underlines are different. (One came with template and one is my custom CSS, I prefer my customization).
  2. When a link is active AND I hover, it has 2 underline decorations. Only want to show one (active)

Can someone help me out 😄  Thanks in advance! Screenshot attached. CSS snippet below.

/* Apply "DM Sans" to paragraphs and headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}
/* Apply the custom font style to all Paragraph 1 blocks */
p {
    font-family: 'Mulish', sans-serif; /* Apply your desired font */
    /* Additional styling, such as font size, color, etc. */
}

/* Apply a hover effect to the button with the class "your-button-class" */
.your-button-class:hover {
    background-color: #ff6600; /* Change this to your desired hover background color */
    /* Additional styling, such as color, border, etc. */
}

/* Apply a custom font style to the header navigation links */
.header-nav-item {
    font-family:'DM Sans', sans-serif;
  font-weight: 500; 
    /* Additional styling, such as font size, color, etc. */
}
/* Apply an underline effect to the header navigation items on hover */
.header-nav-item:hover {
    text-decoration: underline; /* Add an underline on hover */
}
/* Apply an underline effect to inactive header navigation items on hover */
.header-nav-item:not(.header-nav-item--active):hover {
    text-decoration: underline; /* Add an underline on hover */
}

 

Screenshot 2023-10-20 at 2.52.17 PM.png

 

 

Your website is private now. Can you set a password for your site and share it?

https://support.squarespace.com/hc/en-us/articles/205815528-Site-wide-passwords?platform=v6&websiteId=63f08707a1ab1979c11e7d14#toc-set-a-site-wide-password

If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks

MD Rofik
Website Designer and Digital Marketer

Am I helpful? Want to offer me a coffee?
Send me a message if needed any help. I'll try to reply as soon as possible.


 

Link to comment
  • 2 months later...
On 10/20/2023 at 3:58 PM, Web_Solutions said:

Hello! Yes, the password is

limescarf13

I think I may need to upgrade to publish the site. Please let me know if you can't access. I will not take as long to respond this time 🙂

Link to comment

It says: "SITE DELETED This site has been deleted by the owner."

 

https://aardvark-tangerine-ncep.squarespace.com/

Link to comment

Please provide the password to view it

Link to comment

I just checked it and it works like you wanted it. Maybe you found a solution

Link to comment
5 hours ago, sorca_marian said:

I just checked it and it works like you wanted it. Maybe you found a solution

Hi Sorca,

Thanks for checking it, but I see the same issue. When I click on a link in the header and it's in active state, when I hover over the active link a second underline appears. See screenshot.

Screenshot 2024-01-16 at 11.03.30 AM.png

Link to comment

Add the below code in Custom CSS
 

.header-nav-item:hover {
    text-decoration: none;
}

 

Screenshot 2024-01-17 at 16.59.48.png

Link to comment
6 hours ago, sorca_marian said:

Add the below code in Custom CSS
 

.header-nav-item:hover {
    text-decoration: none;
}

 

Screenshot 2024-01-17 at 16.59.48.png

Thank you! That worked, but if you notice in my screenshot, the hover line and the active link line have different spacing beneath the link. Is there a way to make this uniform? (Commissions vs. Classes)

 

Screenshot 2024-01-17 at 1.42.09 PM.png

Link to comment

Yes, in addition to the above code, add the below one as well in Custom CSS

.header-nav-item:not(.header-nav-item--active):hover {
    text-decoration : none;
}

.header-nav-item:not(.header-nav-item--active):hover a {
    background-image: linear-gradient(currentColor,currentColor);
    background-repeat: repeat-x;
    background-size: 1px 1px;
    background-position: 0 100%;
    background-position: 0 calc(100% - 0.1em);
}

 

Screenshot 2024-01-18 at 19.27.48.png

Link to comment
  • Solution
6 hours ago, sorca_marian said:

Yes, in addition to the above code, add the below one as well in Custom CSS

.header-nav-item:not(.header-nav-item--active):hover {
    text-decoration : none;
}

.header-nav-item:not(.header-nav-item--active):hover a {
    background-image: linear-gradient(currentColor,currentColor);
    background-repeat: repeat-x;
    background-size: 1px 1px;
    background-position: 0 100%;
    background-position: 0 calc(100% - 0.1em);
}

 

Screenshot 2024-01-18 at 19.27.48.png

That worked! Thank you!

Link to comment

Please mark my above post as the solution 

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.