the-front-end-knowledge-you-may-not-know
the-front-end-knowledge-you-may-not-know copied to clipboard
pointer-events: none; 穿透当前元素,由“下面”的元素接收事件
简介
pointer-events: none;
表示鼠标事件“穿透”该元素并且指定该元素“下面”的任何东西。
例:红色块上面有一个蓝色块(z-index),如果蓝色块设置了 pointer-events: none;
。点击蓝色块将无效,红色块能捕获到鼠标事件,虽然蓝色块“罩住”了红色块。
兼容性
https://caniuse.com/#search=pointer-events
![qq20180502-101821 2x](https://user-images.githubusercontent.com/3949015/39502327-360c4e54-4df2-11e8-8832-ce93ec276962.png)
实用程度
★★
相关链接
- https://developer.mozilla.org/zh-CN/docs/Web/CSS/pointer-events
这个很实用(虽然不常用)
这个经常用的,公司内部系统的明水印基本就是用这个,暗水印另外处理
这个属性还可以设置移动端的img不可被点击预览 反正还是很有用的。
这个相当实用呢,我做移动端项目经常会用