私は次のようなDOM構造のWebサイトを作成します。
<body>
<div><canvas id="cv"></canvas>
<script>
..some scripts with function and methods to make multiple canvas..
</script>
</div>
<p>lorem ipsum</p>
</body>
問題は、「lorem ipsum」段落が常にキャンバスの後ろに表示されることです。キャンバスの後、または少なくとも、の後に表示することはできません。
スクリプトでは、「createElement」メソッドと「appendChild」メソッドを使用して複数のキャンバスを作成し、divタグに新しいキャンバスを追加します
段落を下に表示するためのアイデアはありますか?(後ろにないキャンバスの後)
完全なページは、多かれ少なかれ次のような同じ構造を持っています。
<html>
<body>
<div id="layer">
<canvas id="myCanvas" width="400" height="300" style="border:2px solid #c3c3c3;position:absolute;left:5px;top:5px">Your browser does not support the canvas element.</canvas>
<script type="text/javascript">
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,150,75);
var id=document.createAttribute("id");
id.nodeValue="test";
var cs=document.createElement("canvas");
document.getElementById("layer").appendChild(cs).setAttributeNode(id);
document.getElementById("test").style.position="absolute";
document.getElementById("test").style.left="7px";
document.getElementById("test").style.top="7px";
document.getElementById("test").width="100";
document.getElementById("test").height="180";
document.getElementById("test").style.border="1px solid";
</script>
</div>
<p>dssdsdsds dsds vdok fekof efienife fienfie fkenfke fkeinf ekfine</p>
</body>
</html>