文章出處

為了去除鏈接的虛線框,網上搜索到最常見的方法是onfocus=“this.blur()”,不過同時搜索到的是這會不利于盲人瀏覽使用頁面

 

在淘寶ued官方博客上詳細說明了解決方法,這里轉了部分,完整版:http://ued.taobao.com/blog/?p=3845(博客園可以放外鏈嗎?)

去除虛線框的方法 優劣 兼容性 是否中斷tab
<a href=”#” onfocus=”this.blur()”>this blur</a> 鏈接聚焦觸發時失去焦點,js和html耦合在一起 沒有兼容性問題
a:focus {outline:none}或
a{outline:none}
outline由css2.1引入,去除虛線框視覺上的問題正是css的職責 ie6/ie7不支持,ie8+/ff /safari/opera[2]支持
<a href=”#” hidefocus=”true” >hidefocus</a> 該屬性是ie的私有屬性[3] ie5+支持
a { noFocusLine: expression(this.onFocus = this.blur())} 可批量處理,但expression的性能問題不能忽視 expression ie6/7支持,ie8+、非ie不支持

 

綜合以上,去除鏈接虛線框的推薦方法是:ie下用hidefocus屬性,ff/chorme/opera/safari下用outline:none。即:

<a href=”#” hidefocus=”true” >鏈接</a>
a:focus {
    outline:none;
}

 

 模版世界:http://www.templatesy.com

 

 

 


文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜

    大師兄 發表在 痞客邦 留言(0) 人氣()