Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent html elements with higher z-index catch events

I´m developing a little Chrome extension to allow user see what they are typing. It's a simple semi-transparent floating div element. The problem that I have is that html elements under it don't receive click events because the div element is over them (> z-index).

My question is:
Is any way to make my div "transparent" for click events (and other type of events)?

An image:

enter image description here

like image 306
lontivero Avatar asked May 01 '13 02:05

lontivero


People also ask

How does a higher z index value affect a positioned element?

The z-index property determines the stack level of an HTML element. The “stack level” refers to the element's position on the Z axis (as opposed to the X axis or Y axis). A higher value means the element will be closer to the top of the stacking order. This stacking order runs perpendicular to the display, or viewport.

How do you fix Z index issues?

To sum up, most issues with z-index can be solved by following these two guidelines: Check that the elements have their position set and z-index numbers in the correct order. Make sure that you don't have parent elements limiting the z-index level of their children.

What does Z Index do in HTML?

Z Index ( z-index ) is a CSS property that defines the order of overlapping HTML elements. Elements with a higher index will be placed on top of elements with a lower index. Note: Z index only works on positioned elements ( position:absolute , position:relative , or position:fixed ).

Why is Z Index not working HTML?

z-index only works on positioned elements (relative, absolute, fixed, sticky) so if you set a z-index on an element with a static position, it won't work.


1 Answers

Try the CSS rule 'pointer-events'.

pointer-events: none;
like image 189
thebreiflabb Avatar answered Oct 27 '22 01:10

thebreiflabb