z index and canvas

Giganews Newsgroups
Subject: z index and canvas
Posted by:  Andrew Poulos (ap_pr…@hotmail.com)
Date: Mon, 10 Aug 2020

I have a DIV overlapping a CANVAS element.

In the HTML, though the DIV appears after the CANVAS, the DIV appears
under the CANVAS.

If I set the DIV's z-index anywhere from 1 to 10000 and the CANVAS to 0
the CANVAS stays on top.

If I don't set the DIV's z-index but set the CANVAS to -1 the DIV is now
on top.

Is there some trick to getting CANVAS to honour a z-index of 0? I'd
rather not set it to -1 because it'll affect other elements ie there are
elements the CANVAS needs to be over.

Andrew Poulos

Replies