Home  >  Article  >  Web Front-end  >  Focus problem onfocus=”this.blur()” alternative method (transfer)_html/css_WEB-ITnose

Focus problem onfocus=”this.blur()” alternative method (transfer)_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:07:341483browse

In order to remove the dotted box of the link, the most common method found on the Internet is onfocus="this.blur()", but at the same time, the search also found that this will not be conducive to blind people browsing the page

The solution is explained in detail on the Taobao ued official blog. Here is part of it. The full version: http://ued.taobao.com/blog/?p=3845 (Blog Park can Put external links? )

去除虚线框的方法 优劣 兼容性 是否中断tab
this blur 链接聚焦触发时失去焦点,js和html耦合在一起 没有兼容性问题
a:focus {outline:none}或
a{outline:none}
outline由css2.1引入,去除虚线框视觉上的问题正是css的职责 ie6/ie7不支持,ie8 /ff /safari/opera[2]支持
hidefocus 该属性是ie的私有属性[3] ie5 支持
a { noFocusLine: expression(this.onFocus = this.blur())} 可批量处理,但expression的性能问题不能忽视 expression ie6/7支持,ie8 、非ie不支持

Based on the above, the recommended method to remove the link dotted frame is: use the hidefocus attribute under ie, and use outline under ff/chorme/opera/safari: none. That is:

Link
a:focus {
Outline:none;
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn