您的位置:首页 > 其它

去掉点击链接时周围的虚线框outline属性

2014-08-18 17:44 169 查看
1.
CSS方式

在IE下是使用html属性:hideFoucs,在HTML标签中加上hidefocus=”true” 属性即可,但这个属性是IE私有的,Firefox是不认的。

<a href="#" hidefocus="true" title="加了hidefocus" >加了hidefocus属性</a>

IE中用CSS处理的方式为:

a{noOutline:expression(this.onFocus=this.blur());}/*
"onFocus" 注意大小写*/

Firefox的处理方法比较符合标准,只需要在样式里设置a:focus{outline:none}皆可:

a:focus{outline:none}

MSIE和FF中的统一处理方法:

a{

outline:none; /*FF*/

noOutline:expression(this.onFocus=this.blur()); /*IE*/

}

考虑性能优化:

a{outline:none;}

a:active{noOutline:expression(this.onFocus=this.blur());}

:focus{outline:0;}

2.
js方式

$("a").bind("focus",
function(){

if(this.blur){

this.blur();

}

});

转自E世年华的博客

原文链接:http://www.cnblogs.com/ango001/articles/2195718.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: