Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

z index and canvas

10 views
Skip to first unread message

Andrew Poulos

unread,
Aug 10, 2020, 1:39:31 AM8/10/20
to
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

James Kirk

unread,
Aug 10, 2020, 6:56:57 AM8/10/20
to
In Message: <mcudnQX2-6kQQK3C...@westnet.com.au>
Can you provide an example that can reproduce this behavior?


--
J𝕒𝕞𝕖𝕤 𝕂𝕚𝕣𝕜


James Kirk

unread,
Aug 10, 2020, 3:09:27 PM8/10/20
to
In Message: <20200810065...@james.kirk.invalid>
James Kirk <noneya....@gmail.com> wrote:

> In Message: <mcudnQX2-6kQQK3C...@westnet.com.au>
> Andrew Poulos <ap_...@hotmail.com> wrote:

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

Suspect that the div position is static.

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

> Can you provide an example that can reproduce this behavior?

Disregard that request unless changing the position does not resolve
the issue.

https://developer.mozilla.org/en-US/docs/Web/CSS/z-index

¦ For a positioned box (that is, one with any
¦ position other than static), the z-index property
¦ specifies:

¦ 1. The stack level of the box in the current stacking
¦ context.

¦ 2. Whether the box establishes a local stacking
¦ context.


--
J𝕒𝕞𝕖𝕤 𝕂𝕚𝕣𝕜


0 new messages