Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Z-index issue on iOS Safari & Chrome

Tags:

html

css

ios

I'm having an issue with a responsive dropdown menu, based on wordpress Underscores theme.

It looks okay on desktop but not on iOS Safari including iPad and iPhone.

enter image description here

I've tried to add z-index to other divs as well but it doesn't work. Please help me. Thanks.

like image 800
myadlan Avatar asked Aug 15 '13 15:08

myadlan


People also ask

Does Z Index work in Safari?

In Safari, it seems that the z-index is not taken into consideration at all.

Why is my Z Index not working?

You set z-index on a static element By default, every element has a position of static. 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.

What does zindex do?

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 ).

What is the z index property?

The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order.


1 Answers

There is actually a fourth method, with translate3d:

-webkit-transform: translate3d(0,0,1px);
transform: translate3d(0,0,1px);

iOS browsers fully support CSS3, so you can use this safely.

like image 67
Fabien Avatar answered Sep 24 '22 10:09

Fabien