去掉链接A标签周围的虚线框(IE、Firefox)<转>

一直没发觉原来text-index,会影响到A标签的虚线框(IE好像不会),点击时会产生难看的虚线。最近,项目整改的时候,这个问题折腾很很久。所以,整理了一些资料。以供参考。

一、局部消除

1.firefox 的链接有时会产生难看的虚线说是因为负值的 text-indent 的缘故,可我怎么觉得是因为 block元素外面没有被限制的原因。可以使用 outline:none 来消除点击链接时的虚线。<a href=”#2″ mce_href=”#2″ style=”display:block;outline:none;”>aaa bb</a>

2.IE使用这三种方法消除链接虚线

(1)<a href=”#1″ mce_href=”#1″ hidefocus=”true”>aaa</a>

(2)<a href=”#1″ mce_href=”#1″ style=”nofocus:expression(this.onFocus=this.blur())”>aaa</a>

(3) <a href=”#1″ mce_href=”#1″onfocus=”blur()”>aaa</a>

二、全局消除 CSS实现(实践可用)

a{blr:expression(this.onFocus=this.close());} /* 只支持IE,过多使用效率低 */

a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,过多使用效率低 */

a:focus { -moz-outline-style: none; } /* IE不支持 */

a:focus { outline: none; } /*很多网站都会加的属性*/

posted @ 2011-03-01 20:16  王大湿  阅读(688)  评论(0编辑  收藏  举报