经测试只有在IE chrome才会在获取焦点时有边框

使用CSS

div{
outline:none;
}

DIV焦点事件详解 --【focus和tabIndex】​

摘自:http://my.oschina.net/jgy/blog/131970

添加 tabindex='-1' 属性;

默认:获取不到焦点事件(blur)

<div class="wl-product" id="wl-product"></div>

可以获取焦点事件(blur)

<div class="wl-product" id="wl-product" tabindex='-1'></div>

首先看看w3c关于onfocus的部分
The onfocus event occurs when an element receives focus either by the pointing device or by tabbing navigation. 
This attribute may be used with the following elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON. 
当元素通过指定(点击)或tab导航(Tabbing navigation)获得焦点,onfocus事件就会触发。
该属性会使用在以下元素(就是说默认可以获取焦点的元素):A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.

div, frameSet, span, table, td.只有设置tableindex才能获取焦点,但

IE默认能获取焦点但不能tab导航

不同tabIndex值在tab order(Tabbing navigation)中的情况:
Objects with a positive tabIndex are selected in increasing iIndex order and in source order to resolve duplicates.
Objects with an tabIndex of zero are selected in source order. 
Objects with a negative tabIndex are omitted from the tabbing order.
tabIndex值是正数的对象根据递增的值顺序和代码中的位置顺序来被选择
tabIndex值是0的对象根据在代码中的位置顺序被选择
tabIndex值是负数的对象会被忽略

html中div获取焦点,去掉input div等获取焦点时候的边框的更多相关文章

  1. input+div 下拉选择框

    前台html页面 <html> <head> <meta name="viewport" content="width=device-wid ...

  2. css pre如果同时运用了css的border-radius、 overflow两个属性且标签中内容太多时,外部div滚动条在firefox下滚动时很卡

    pre如果同时运用了css的border-radius. overflow两个属性且标签中内容太多时,外部div滚动条在firefox下滚动时很卡. 解决方法:去掉css中border-radius. ...

  3. 在div中设置文字与内部div垂直居中

    要实现如图一所示的结果: html代码如下: <!DOCTYPE html> <html> <head lang="zh"> <meta ...

  4. 一个div在另一个div中水平垂直的方法

    html <div id="main"> <div id="box"> 一个div在另一个div中垂直居中实现方法 </div&g ...

  5. html5中如何去掉input type date默认

    html5中如何去掉input type date默认样式 2.对日期时间控件的样式进行修改目前WebKit下有如下9个伪元素可以改变日期控件的UI:::-webkit-datetime-edit – ...

  6. 关于自适应屏幕,设置子元素浮动,父div不能包裹子div,子元素中内容溢出的问题。

    设置HTML适应不同分辨率的屏幕. 需求结构如下: HTML结构代码如下(只是其中一条): <body> <div class="content">< ...

  7. div中嵌套的多个div使用了浮动后居中的办法

    今天做网页的时候遇到了标题中的问题,网上查到了解决办法,记录一下一放以后忘记 <div class="wai"> <div style="float:l ...

  8. 解决echart在IE中使用时,在div中加入postion后图表不显示问题

    <!-- 为ECharts准备一个具备大小(宽高)的Dom --> <div id="main" style="height:400px;width:1 ...

  9. 大div中,三个小div水平居中

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

随机推荐

  1. Shell--nl命令

    nl命令在linux系统中用来计算文件中行号.nl 可以将输出的文件内容自动的加上行号!其默认的结果与 cat -n 有点不太一样, nl 可以将行号做比较多的显示设计,包括位数与是否自动补齐 0 等 ...

  2. 2014ACM/ICPC亚洲区域赛牡丹江站现场赛-A ( ZOJ 3819 ) Average Score

    Average Score Time Limit: 2 Seconds      Memory Limit: 65536 KB Bob is a freshman in Marjar Universi ...

  3. vue - check-versions.js for chalk

    chalk:npm 官网 修改命令输出的文字颜色.粗细等....

  4. $ gulp watch 运行出错解决方法

    $ gulp watch 运行出错解决方法   $ gulp watch     如果你出现了如下报错信息: gulp-notify: [Laravel Elixir] Browserify Fail ...

  5. 【BIEE】12_查看BIEE的物理SQL

    有时候,我们在使用BIEE的时候回出现一些问题,需要借助物理SQL来进行问题分析.通过物理SQL我们就可以看到BIEE在数据库中是如何去检索出数据库. 查看物理SQL的方式 [登录BIEE]--[管理 ...

  6. 为 jquery validate 添加验证失败回调

    转载自:https://blog.csdn.net/huang100qi/article/details/52619227 1. jquery Validation Plugin - v1.15.1 ...

  7. JWT—JSON Web Token - 理解JWT网络间应用用户安全认证交互设计

    原文地址:http://blog.leapoahead.com/2015/09/06/understanding-jwt/ 官网地址:https://jwt.io/ JSON Web Token(JW ...

  8. 【CODEFORCES】 C. Captain Marmot

    C. Captain Marmot time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  9. 通过 P3P规范让IE跨域接受第三方cookie session

    所谓第三方 cookie,就是说你访问网页 A,却接收到域名 B 的 cookie 设定指令.这可能是由于网页 A 请求或链接了 B 的网页,比如上面提到的 iframe 以及 jsonp. 我查到了 ...

  10. ORCAD应用小技巧

    1.位号复制 递增和不变 2.netlist log信息 3.off page页码对其 4.批量修改off page符号命名的方法 5.批量修改电源符号 6.capture中instance和Occu ...