天天看点

CSS去掉点击时的虚线

也许你会觉得当点击时焦点出现的虚线很不好看,那就让我们把它去掉吧!

一,在<a>标签中加入onFocus="this.blur()"语句:

-----------------------------------------------------------

<a href="#" target="_blank" rel="external nofollow" onFocus="this.blur()">try</a>

-----------------------------------------------------------

二,在<a>标签中加入hidefocus:

-----------------------------------------------------------

<a href="###" target="_blank" rel="external nofollow" hidefocus>link</a>

-----------------------------------------------------------

三,如果连接太多,可以用外部链接 .HTC 文件。

如,blur.htc 文件内容如下:

----------------------------------------------------------

<public:attach event="onfocus" onevent="makeblur()"/>

<script language="javascript">

function makeblur(){

this.blur();

}

</script>

-----------------------------------------------------------

在 CSS 中加入如下代码:

-----------------------------------------------------------

A { behavior:url(blur.htc); }

-----------------------------------------------------------

四,使用CSS样式,可加入代码:

-----------------------------------------------------------

a {blr:expression(this.onFocus=this.blur())}

-----------------------------------------------------------

这样,站内所有的文章都实现了无虚线效果了。

继续阅读