Is it possible to have a element within another element? I know i can layer them, but is this possible -
<canvas id="parent">
<canvas id="child"></canvas>
</canvas>
I tried but doesnt seem to work.
If you want to handle background and foreground separately, you could use two canvas and put one above the other with css.
<canvas id="bg" width="640" height="480" style="position: absolute; z-index: 0">
</canvas>
<canvas id="fg" width="640" height="480" style="position: absolute; z-index: 1">
</canvas>
Actually this one of the tips to improve canvas performance. Source: HTML5 Rocks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With