I have 2 canvas layers that are positioned on top of each other.
However I need to position them relative to the page.
The width of the layers is 800 and the height 300.
I want to have it center no matter what size screen it is on, and have the height adjust for each size screen also.
Currently I am using:
<div>
<canvas id="canvas" width="800" height="300" style="position: absolute; left:20%; top: 40%; z-index: 0;"></canvas>
<canvas id="canvasAnimation" width="800" height="300" style="position: absolute; left: 20%; top: 40%; z-index: 0;"></canvas>
</div>
And using lots of <br>
to make room for it to be placed.
I am using jQuery also. I know how to get the width of a screen if that helps.
You can use the following code and set the width of the container rest all would be set automatically: