Change links CSS

Posted in: Newspaper
Post count: 66

Maybe what I’m going to ask is not included in the theme support. If that is the case, just let me know and there’s no problem.

I would like to customize the links inside my posts and pages content. ¡Only the ones that are in the content!

I want to give them a colored underline, a higher font weight, etc.

The problem is that I don’t know which is the element I have to use for it on the custom css.

Is there any element on the theme that only applies to the links inside the content of the posts and pages?

Thank you so much.

Bernat

Post count: 22421

Hello,

Unfortunately the theme does not add any custom class or id for the links you add in the post content. As you know, css needs a class or an id in order to target specific elements if you want your code to not affect every element of the same type. The links inside the posts will need to have a custom class set to them when creating the link. This is the best case scenario. You can simply target the a tag inside the post content with a general selector like .td-post-content a{css code here} and it will work and apply the css to all links inside the post content, but there are however links that you probably do not want affected like widgets, plugins, or other content that has a link that does not need to be changed. This is where the class comes in. If your links get a class then you can target only those specific links using this selector:
.td-post-content .mycustomlinkclass {css code here}
I hope this helps.
Thanks

Post count: 3

Hello,

is it planned to add a class for links in the future? This would be really helpful to customize the links in the post and page content.

I´d tried to use the span X class but then every span X class is effected.

Thanks

Post count: 28

Hello, I’m using following codes to stylize my links;
.td-post-content a {
text-decoration:underline;

}
.td-post-content a:hover {
background-color:#2b5797;
color:#fff;
text-decoration: none;
}

Post count: 66

It worked! It only affects to the links inside the posts!

Thank you!!!

Post count: 3

Hello, this should also work for pages, right?

When I try the following code it doesn´t change the hyperlink – I guess .td-page-content has no function when .td-page-content is working fine. Do I have to activate something?

.td-page-content a {
text-decoration:underline!important;
}

Post count: 22421

Hello,

Simply changing the name post with page will not work because the pages dfo not have a td-page-content class.
The class for pages is td-main-page-wrap but there are many links in that page and the code is too general. Posts do not have many links but pages do. Y
On pages however it;s much easier as you can use the composer to add a custom class to the row containing the link so you can target that specific custom class you add in the page builder.

Thank you!

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.