In my example, I tried setting the z-index of a canvas to 0 and the z-index of a div to 1. However, despite this configuration, the canvas appeared higher than the div. Surprisingly, when I set the z-index of the canvas to -1, it worked as expected. Can anyone explain why this is happening?
<div id='all'>
<canvas style="width:100px;height:100px; position:absolute;left:10%;z-index:-1;background-color:yellow;"></canvas>
<div id=highscore style="width:100px;height:100px;z-index:1;background-color:red;">
</div>
</div>