使用CSS更改链接文本 [英] Change Link text with CSS

查看:48
本文介绍了使用CSS更改链接文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用CSS更改链接文本,但这不起作用.

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.

推荐答案

您可以使用 font-size:0; 隐藏原始文本,然后将原始字体大小添加回您的文本中:

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>

这篇关于使用CSS更改链接文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆