Jump to content

Change link color on hover

Go to solution Solved by MacGregor,

Recommended Posts

Posted (edited)

I would like to learn how to change a text link color upon hovering the link. I have learned how to do this in the header of my website but I would also like to do this in the body and footer of the website. I have much experience with HTML and CSS code. I have tried the following in the body (Design > Custom CSS) but it isn't working:
 

p a {
  color: #113267;
  text-decoration: none;
}

p a:active {
  color: #000000;
  text-decoration: underline;
}

p a:hover {
  color: #000000;
  text-decoration: underline;
}

I'm clearly doing something wrong and would like to learn how to fix the issue. Is this kind of code supposed to be placed in each page? The website in question is here:

https://www.northseattlenazarene.org/

Edited by MacGregor
added more information
  • Solution
Posted

Ok, for anyone having a similar question I've found a solution. The solution involves nesting of CSS code, which I was unaware was even a thing.

Here is what I found:
 

/* Header link styling */
.header-nav-list a:hover {
  color: #e7b557 !important;
}

/* Body link styling */
a:hover {
span.sqsrte-text-color--black {
  color: #1e57b4;
  text-decoration: underline;
}
}

/* Footer link styling */
a:hover {
span.sqsrte-text-color--custom {
  color: #cecece !important;
  text-decoration: underline;
}
}

Notice how the CSS for the body and footer is nested while the code for the header is not nested, this was why I was able to style the links in the header without assistance. The links in the body and footer seem to require nesting the code - which was why I couldn't do it on my own, I had no idea that nesting was a thing in CSS.

Well, I learned something new.. and you can't put a price on that. Thank you, Squarespace!

  • 4 months later...

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.