Archived topic
CSS for links
13 replies · Started by William on August 11, 2021
Hi is there CSS I can put in place to make my links bold and then "highlighted" with a certain when hovered over? Similar to this article:
https://hiconsumption.com/best-cycling-roads-in-america/
The first link if you hover over it, highlights with the underlined color. Any CSS to make that happen in generatepress?
Hi there,
Try something like this:
.entry-content a {
border-bottom: 3px solid #1ad1bd;
box-shadow: inset 0 -4px 0 #1ad1bd;
}
.entry-content a:hover {
background-color: #1ad1bd
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
Leo thanks so much for the quick response. I was close in my own CSS!
Is there a way to ensure that this does not apply to the buttons on the site? Currently the CSS you provided seems to affect the buttons as well.
Any chance you can link us to the site in question?
You can use the private information field:
https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Let me know :)
This should be your CSS:
.entry-content a:not(.wp-block-button__link) {
box-shadow: inset 0 -1px 0 currentColor;
transition: color 100ms ease-in,box-shadow .13s ease-in-out;
}
Leo thank you so much. That works perfectly. If I want the links font weight to be 900, could I add that to the CSS?
.entry-content a:not(.wp-block-button__link) {
box-shadow: inset 0 -1px 0 currentColor;
font-weight: 900;
transition: color 100ms ease-in,box-shadow .13s ease-in-out;
}
Hi there,
yes, thats correct.
Thank you, David.
Last thing I'm trying to do is remove the underline on the links. I tried adding in text-decoration: none; (as seen below, but that doesn't seem to be doing the trick. Am I missing something obvious?
.entry-content a:not(.wp-block-button__link) {
box-shadow: inset 0 -1px 0 currentColor;
font-weight: 900;
text-decoration: none;
transition: color 100ms ease-in,box-shadow .13s ease-in-out;
}
Can you disable the SG Optimizer so i can see whats going on there?
Done!
Hi William,
Last thing I’m trying to do is remove the underline on the links.
It's not underline, it's the box shadow, and the code appears twice:
https://www.screencast.com/t/mU3XO4Y73PfV
You can remove the code that I highlighted in the above screenshot to test.
Let me know :)
Awesome that worked.
Thank you to Ying, David and Leo!
You are welcome :)