您现在的位置: 像素吧 >> 设计教程 >> css样式 >> 正文

text-indent 隐藏文字 出现虚线框outline

来源:不详 日期:2008-1-7 22:46:45 作者:佚名 查看:
"text-indent 隐藏文字 出现虚线框outline"这篇css样式如果帮助了您,请记得分享给您身边的朋友,如果您有比"text-indent 隐藏文字 出现虚线框outline"更好的教程请发布共享,帮助别人快乐自己!
 
  链接用图片做背景,text-indent:-9999px; 隐藏文字,此效果在 IE 中是正常的,但在 Firefox 里,鼠标点击该链接时,虚线框却会包住被缩进的文字,结果显示为虚线框 N 长。

  因为平时是用overflow:hidden; 属性的,所以一直也没有注意到这个问题的存在,但当你需要使用 JS 来实现某种交互时,强烈建议不要使用 overflow:hidden; 属性,因为会给你带来很多意想不到的麻烦。

  虚线框,其实就是 CSS 中的 outline 属性,这也说明 IE 和 Firefox 对于 outline 和 border 的解析范围并不一致:IE 认为虚线框就是border的边缘,而 Firefox 则认为虚线框应该是文字范围。

  那 W3C 中是如何定义 outline 的呢?

div css xhtml xml Example Source Code Example Source Code [www.52css.com]At times, style sheet authors may want to create outlines around visual objects such as buttons, active form fields, image maps, etc., to make them stand out. CSS2 outlines differ from borders in the following ways:
1. Outlines do not take up space.
2. Outlines may be non-rectangular. 
  把虚线框去掉了a:focus { outline:0 } ,毕竟这个问题只存在 Firefox 中。

相关评论:

发表评论

  • 昵 称:
  • 内 容:
  •  
  • 虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号!