tangara — 2012-08-13T05:33:51-04:00 — #1
Hi forum experts,
I remember playing with Z-Index in terms of placing my image at the location desired in my web-site.
Now, with HTML 5 Canvas, I wonder if Z-Index is no longer valid?
Hope to hear from you soon.
markbrown4 — 2012-08-13T07:08:25-04:00 — #2
In Canvas you basically print pixels on top of the existing painting like paint on a... canvas
Animation is mostly frame by frame where you paint, clear, paint, clear etc..
So, z-index doesn't make sense because there's no such thing as layers - there's only ever 1 layer.
Hope it helps
ralphm — 2012-08-13T09:59:03-04:00 — #3
Yes, z-index still very much has its place in CSS, and will continue to do so.
tangara — 2012-08-13T22:19:58-04:00 — #4
Erm...do you have an example to show you meant ? Can't really understand putting a layer on top of another. Isn't Z Index work the same. We put in a background colour and then we use the Z-Index to put another image on top ?
markbrown4 — 2012-08-14T03:42:15-04:00 — #5
I read more into your question than I should have, see Ralph's answer above.
The majority of websites don't need canvas at all, it has a very small use-case.
If you do need canvas for something in the future you'll learn that it's just an element that you can paint pixels onto.
you can't have multiple elements in a canvas at different z-index. There's only ever one element the <canvas>