I want to change my link Text with CSS, but it doesn't work.
a.testclass {
display: none;
}
a.testclass:after {
content: 'new text';
}
<a class="testclass;" href="someurl.com"> CHANGE THIS HERE </a>
Display none works for me but not the new text.
You can hide the original text by using font-size:0;
then adding the original font size back to your after:
a.testclass {
font-size:0;
}
a.testclass:after {
content: 'new text';
font-size:16px; /* original font size */
}
<a class="testclass" href="someurl.com"> CHANGE THIS HERE </a>
Use font-size: 0
to hide the original text. To restore the original size use font-size: initial
. You won't need to care about the original value.
a.testclass {
font-size: 0;
}
a.testclass:after {
content: 'new text';
font-size: initial;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With