Archived topic
Style links
3 replies · Started by gabrielvb1100 on October 18, 2020
Hello, I want to style links , but only the links that appear in posts or pages and not links in titles like h2, h3
I am currently using :
.entry-content a:link {
color: #000000 !important;
font-weight:bold !important;
background-color: #ffe7e7 !important;
}
but that style links in my homepage where some links are h2, is there a way to avoid this?
Hi,
You can exempt links from your CSS by adding the :not() pseudo-class.
Example 1: "Excluding h2 and h3"
.entry-content a:not(h2):not(h3) {
color: #000000 !important;
font-weight:bold !important;
background-color: #ffe7e7 !important;
}
Example 2: "Excluding entry-title class"
.entry-content a:not(.entry-title) {
color: #000000 !important;
font-weight:bold !important;
background-color: #ffe7e7 !important;
}
Thanks, that did the trick
No problem. :)