• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

[Req] Hyperlink underline decoration

rajujha

Member
Jul 24, 2019
55
6
8
Dear members, I need help to use hyperlink decoration as used in national geographic website

https://www.nationalgeographic.com/...presidents-day-celebrates-only-one-president/

It is a hyperlink with underline and color on hover with the accent color (yellow in their case, I need red in mine).

I am using the Newspaper by tagdiv theme and I don't see this option in customization. Anyone with good CSS knowledge can help me, I will be grateful. I need this feature as I am to reference a lot of links that looks untidy with the red accent color of my website.

My website: https://trainingindustry.in

All help will be highly appreciated.
 
CSS:
a:hover {
  background-color: #DB4437;
}
Thanks but this will only change background hover color, I need an underline with red with black hyperlink text.

Also, this will make all the links with hover background. I wish to limit it to post content.
 
CSS:
.td-post-content a {
color: #000 !important;
text-decoration: underline;
  -webkit-text-decoration-color: #DB4437; /* Safari */
  text-decoration-color: #DB4437;
}

.td-post-content a:hover {
  background-color: #DB4437;
}
 
The way it is done on the example website is more smooth. Just check in the developer console of the browser how they do it, and in the process learn a little about CSS.

On a side note: I think black text on the red background looks terrible (and for some people is very difficult to read).
 
CSS:
.td-post-content a {
color: #000 !important;
text-decoration: underline;
  -webkit-text-decoration-color: #DB4437; /* Safari */
  text-decoration-color: #DB4437;
}

.td-post-content a:hover {
  background-color: #DB4437;
}

@unicorn Thanks a ton....It works like a charm. If you could help me with increasing the underline width that will be great.

Also, I use newspaper theme on two of my websites. However, for the website for which I have shared the link above, a black underline comes on hover, how to remove that?
 
The way it is done on the example website is more smooth. Just check in the developer console of the browser how they do it, and in the process learn a little about CSS.

On a side note: I think black text on the red background looks terrible (and for some people is very difficult to read).

Only the underline color is red. On hover text is covered in red, so doesn't look distracting.

I have implemented it now with @unicorn help you can see it now (still need to remove black underline on hover, probably also change the text color to white on hover).

Most of the well known blogs are implementing this method of hyperlink decoration and looks modern.

Sadly newspaper theme still does not have that customization.
 
edited: padding text

--------
use this to forced the red underline and background at hover link.

CSS:
.td-post-content a:hover {
color: #fff !important;
  background-color: #DB4437;
text-decoration: underline;
  -webkit-text-decoration-color: #DB4437 !important; /* Safari */
  text-decoration-color: #DB4437 !important;
padding: 0 5px !important;
}
 
Last edited:

Forum statistics

Threads
79,522
Messages
1,144,270
Members
249,560
Latest member
potatogod
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock