Jump to content

Need help to troubleshoot css for hyperlinks

Go to solution Solved by tuanphan,

Recommended Posts

Hi,

I want all of my hyperlinks in both headings and paragraphs to change color when hovered, but my code only works on the headlines for some reason. I only have basic knowledge of CSS, and I can't figure out what's wrong. 

a:hover {
    color: #f48947;
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

- I've tried changing the first line to h3 a, p a:hover {} but paragraph links still won't work
- If I add another block with the same code below it, any text-decoration changes seem to affect the paragraph links, but the color won't change. 
- I've tried adding the !important command, but it doesn't work. 

 

Is there any brilliant mind out there who can help me?

sofiawiklander.com


 

Edited by sosofofia
added link to website
Link to comment
  • Replies 4
  • Views 243
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

You were close! Try:

p:hover {
    color: #f48947;
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

You can also make it block-specific:

#blockID {
    p:hover {
        color: #f48947;
        text-decoration: underline;
        text-decoration-thickness: 1px;
    }
}

Link to comment
  • Solution
On 4/2/2023 at 1:50 AM, sosofofia said:

Hi,

I want all of my hyperlinks in both headings and paragraphs to change color when hovered, but my code only works on the headlines for some reason. I only have basic knowledge of CSS, and I can't figure out what's wrong. 

a:hover {
    color: #f48947;
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

- I've tried changing the first line to h3 a, p a:hover {} but paragraph links still won't work
- If I add another block with the same code below it, any text-decoration changes seem to affect the paragraph links, but the color won't change. 
- I've tried adding the !important command, but it doesn't work. 

 

Is there any brilliant mind out there who can help me?

sofiawiklander.com


 

Change your code to this

a:hover, a:hover span {
    color: #f48947;
    text-decoration: underline;
    text-decoration-thickness: 1px;
}

 

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.