As you already stated, the element .page2
is being rendered in front of the other element because of the transform
property.
One way to solve this would be to add pointer-events: none
to the element in order to prevent it from affecting the other element.
.page2 {
pointer-events: none;
}
As MDN states:
the value 'none' instructs the mouse event to go "through" the element and target whatever is "underneath" that element instead.
UPDATED EXAMPLE - just be aware of pointer-events
's support.
An alternative to pointer-events
, would be to bring the element forward with translateZ
.
button {
-webkit-transform: translateZ(20px);
}