内容 |
方法一: ie 下可使用其私有的html属性:hidefocus,在标签的结构中加入 hidefocus=”true” 属性。即: <a href=http://www.taobao.com hidefocus=true title=></a> 而在 firfox 浏览器中则相对比较容易,直接给标签 a 定义样式 outline:none; 就可以了,即: .hidefocus { outline:none;/*outline:0;也可以*/ } 方法二: 也可以仅用 css 来控制,即对 ie 的情形使用 expression 表达式,但不推荐使用,毕竟 expression 在性能上有问题。 .hidefocus { hide-focus: expression(this.hidefocus=true); /* for ie 5+ */ outline: none; /* for firefox 1.5 + */ } opera9 似乎默认就不显示焦点虚线框。 除链接外,该 css 同样适用于 input 和 button 标签。 ie6, ie7, ff1.5, ff2, opera9 测试通过。 |