In some cases, you can bring an element up without using CSS directly. If you put your DIVs in the body tag or under another parent element, you can reattach it to the parent. JavaScript will move it to the last position in the child list, which will bring the element in a "natural" way to the top.
Example:
myElement.parentNode.appendChild(myElement);
I used this trick for my custom context menu. Works without zIndex.
StanE source share