如何隐藏锚文本而不隐藏锚? [英] How do I hide anchor text without hiding the anchor?

查看:63
本文介绍了如何隐藏锚文本而不隐藏锚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有以下标记:

<li><a href="somehwere">Link text</a></li>

如果a标签上有背景图片,如何仅使用CSS隐藏链接文本?除了在ie7的小斑点显示中,font-size:0似乎可以在a标签上正常工作.

If I have a background image on the a tag, how would I hide the link text using just css? font-size:0 seems to work fine on the a tag apart from in ie7 little blobs show.

  • 到目前为止,感谢您的帮助,我已经使用 line-height:0; font-size:0; text-indent:-999px .但是它仍然在野生动物园中显示出一些斑点,有什么想法吗?
  • Thanks for help so far I have used line-height: 0; and font-size: 0; and text-indent: -999px. But it still shows up some blobs in safari, any ideas?

推荐答案

尝试

 a{
    line-height: 0; 
    font-size: 0;
    color: transparent; 
 }


color:transparent; 涵盖了Webkit浏览器仍显示1px文本的问题.


The color: transparent; covers an issue with Webkit browsers still displaying 1px of the text.

这篇关于如何隐藏锚文本而不隐藏锚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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