Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does w3c standards allow for same z-indexes

Just a quick question and I can't find the answer. I heard somewhere that you can't (well you can but it won't conform to w3c standards) have the same z-indexes. Is this true? Can I have two <div> elements with the z-index of 3? Thanks.

like image 672
Ben Avatar asked Nov 30 '22 08:11

Ben


2 Answers

This is incorrect. It is valid to have multiple elements with the same z-index. To quote W3C's CSS2 spec:

Boxes with the same stack level in a stacking context are stacked back-to-front according to document tree order.

like image 115
Nathan Ostgard Avatar answered Dec 09 '22 23:12

Nathan Ostgard


You can have two with the same index. they will just be layered in the order they appear in the html.

like image 21
nickmoriarty Avatar answered Dec 09 '22 23:12

nickmoriarty