CSS3 pointer-events(阻止hover、active、onclick等触发事件)

html-css011

CSS3 pointer-events(阻止hover、active、onclick等触发事件),第1张

Firefox 3.6+和chrome 2.0+ 以及safari 4.0+都支持这个CSS3属性,IE6/7/8/9都不支持(IE11又支持,不过很好的一点是在ie中给a加disabled 点击事件自动无效。),Opera在SVG中支持。 但是 该属性HTML中 不支持

1、提交页面,提交按钮点击后,添加这个样式属性(style="pointer-events"),来防止重复提交

2、让链接不能点击

3、让鼠标点击穿透上方的 div

楼上说的是对的,或者把代码放<head>里,像下边那样。希望可以帮到你。

<html>

<body>

<script>

function testDemo(){

setTimeout("alert('ok')",3000)

}

</script>

<table>

<tr>

<td><a onmouseout="testDemo()" href="http://www.baidu.com" target="_blank">链接</a></td>

</tr>

</table>

</body>

</html>

是不是a的背景颜色不能完全填充?

a属性再加上:{

display:block

width:80px

height:25px

}

这样的话颜色应该可以完全填充了,但是这种导航一般都不是用table做,table不够灵活且编码麻烦,最佳方法是使用ul li的方式,如:

<ul>

<li>导航一</li>

<li>导航二</li>

<li>导航三</li>

<li>导航四</li>

</ul>

css:

ul{

list-style-type:none

}

ul li{

float:left

width:80px

height:25px

line-height:25px

}

ul li a{

text-decoration:none

........

}

ul li a:hover{

......

}