MacGregor Posted July 11, 2023 Posted July 11, 2023 (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 July 11, 2023 by MacGregor added more information
Solution MacGregor Posted July 11, 2023 Author Solution Posted July 11, 2023 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! tuanphan 1
NorahAdams Posted December 4, 2023 Posted December 4, 2023 Hi this works for me on the header but still not on text links...any idea why?
tuanphan Posted December 6, 2023 Posted December 6, 2023 On 12/5/2023 at 3:54 AM, NorahAdams said: Hi this works for me on the header but still not on text links...any idea why? Can you share link to page where you use textlink? 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!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment