一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

A标签虚线框去掉3种方法(CSS/JS/jquery)

时间:2014-08-29 编辑:简简单单 来源:一聚教程网


1. CSS方式去掉链接虚线框的方法:

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

加了hidefocus属性

IE中用CSS处理:

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

* "onFocus" 注意大小写*/

Firefox的处理方法比较符合标准,只需要在CSS样式代码里设置a:focus

{outline:none}皆可。接下来看一下MSIE和FF中统一处理的方法:
a{
outline:none; /*FF*/
noOutline:ex
pression(this.onFocus=this.blur());/*IE*/
}

css htc文件处理

a {behavior:url("htc文件")}

考虑性能优化,可参考以下代码:

a{outline:none;}
a:active{noOutline:expression(this.onFocus=this.blur());}
:focus{outline:0;}

2. 用js方式解决链接虚框的方法:


利用javascript的onfocus事件,实现如下:


设计蜂巢


JQ的写法:

$("input:not(input[type='text'],input[type='password'])").focus(function(){
    this.blur();
});

热门栏目