Your css ok but you set wrong selector. You has id = canvas_container
but set styles for class canvas_container
and class container
#canvas_container {
position: relative;
width: 330px;
height: 330px;
}
#canvas_container > canvas {
position: absolute;
top: 0;
left: 0;
border: 1px solid red;
}
<div id="canvas_container">
<canvas id="Background" width="330" height="330"></canvas>
<canvas id="mycanvas" width="330" height="330"></canvas>
<canvas id="Overlay" width="330" height="330"></canvas>
</div>
<div id="codeinput">
<br>
The "X" goes here:<input type="text" id="shapeX">
<br>
The "Y" goes here:<input type="text" id="shapeY">
<br>
Choose the color: <input type="text" id="shapeColor" value="green">
<br>
<button onclick=makeSquare();>Draw shape</button>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…