- This topic has 17 replies, 4 voices, and was last updated 3 years ago by
David.
-
AuthorPosts
-
March 12, 2023 at 9:36 am #2565086
Anjali Chawla
Hi,
I want to have the background color and text color change on the link hovering exactly the same way as on this site: https://nomadicated.com
Please help.
Thanks!
March 12, 2023 at 10:42 am #2565123Leo
StaffCustomer SupportHi there,
Not sure if I fully understand.
Is there a specific section we should be looking at in the example site?
Please also provide your site in question as well.
Thanks!
March 12, 2023 at 10:02 pm #2565422Anjali Chawla
Hi,
On the example site, check any one of the posts. When you hover over the underlined link, the color of the link text and the background color change. I want that effect.
Thanks!
March 12, 2023 at 10:54 pm #2565452Fernando Customer Support
Hi Anjali,
Try adding this through Appearance > Customize > Additionnal CSS:
.single-post .entry-content a::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; background-color: var(--global-color-8); width: 100%; z-index:1; transition: height 0.2s ease-in; } .single-post .entry-content a{ position: relative; border: none; white-space:nowrap; } .single-post .entry-content a:hover{ border:unset !important; } .single-post .entry-content a:hover::after { height:100%; z-index:-1; } .single-post .entry-content a:hover{ color: #fff !important; z-index: 1000; }March 13, 2023 at 12:30 pm #2566424Anjali Chawla
Hi Fernando,
Thanks for the help.
The code is working mostly, however, there are a few links that are not showing the underline, and while their text is changing to white but the background color isn’t changing. Please check the links to the Vietnam itinerary and the best places to stay in Phu Quoc in my latest post about Vietnam. I’ve shared the link to the post in private info.
Just so you know, I’m already using the CSS code for underlining the links:
}
body.single-post .entry-content a:hover {
border-bottom: 3px solid #a64253;
padding-bottom: 3px;
}Kind regards,
AnjaliMarch 13, 2023 at 5:54 pm #2566639Fernando Customer Support
I see. Can you remove the code you have first and I’ll re-check?
March 13, 2023 at 9:22 pm #2566721Anjali Chawla
Sure. I’ve removed the CSS code for underlining the link.
March 13, 2023 at 9:50 pm #2566734Fernando Customer Support
I updated the code here: https://generatepress.com/forums/topic/background-and-text-color-change-on-hover/#post-2565452
Can you update yours with this new code?
March 13, 2023 at 10:12 pm #2566745Anjali Chawla
Hey Fernando,
This works 🙂 However, the line under some links is thicker than others like in the recent post in a Vietnam essentials box if you see the line under Cookly or Lonely Planet Guidebook is thicker than the lines under Viator or Get your Guide. Can you check, please?
March 13, 2023 at 10:50 pm #2566766Fernando Customer Support
Try setting the
height: 2px;toheight: 3px;March 13, 2023 at 11:46 pm #2566802Anjali Chawla
It’s fixed. Thank you so so much, Fernando 🙂
March 13, 2023 at 11:56 pm #2566820Fernando Customer Support
You’re welcome, Anjali! 🙂
March 15, 2023 at 12:30 am #2568140Anjali Chawla
Hey Fernando,
I just noticed that the mobile layout of my blog is disturbed after adding the CSS.
Please check the blog on mobile. The content is not visible properly, you’ll have to scroll horizontally to read the content. That’s strange.
What can be the issue? Please help fix it.
Thanks!
March 15, 2023 at 12:49 am #2568153Fernando Customer Support
Can you try changing the code to this?:
@media (min-width: 1025px){ .single-post .entry-content a::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; background-color: var(--global-color-8); width: 100%; z-index:1; transition: height 0.2s ease-in; } .single-post .entry-content a{ position: relative; border: none; white-space:nowrap; } .single-post .entry-content a:hover{ border:unset !important; } .single-post .entry-content a:hover::after { height:100%; z-index:-1; } .single-post .entry-content a:hover{ color: #fff !important; z-index: 1000; } }March 15, 2023 at 6:19 am #2568482Anjali Chawla
Hey Fernando,
It has fixed the layout issue on mobile but then the link hover effect also isn’t showing on mobile.
-
AuthorPosts
- You must be logged in to reply to this topic.