umieszczenie div na płótnie w HTML5
Próbuję umieścić element div na płótnie (dotyczy gry) na środku mojej strony. Chodzi o ekran startowy, który chcę pokazać na płótnie, przed rozpoczęciem gry (ten ekran startowy ma opcje takie jak „Zagraj w grę”, „Ustawienia” itp.). Problem polega na tym, że nie mogę tego zrobić, dużo przeszukałem w Google, widziałem wiele przykładów, ale żaden z nich nie wydaje mi się działać. Oto mój kod:
<div id="gamecontainer">
<canvas id="myCanvas" width="800" height="600">
Sorry, <strong>CANVAS</strong> is not supported by your browser. Get a more recent one to play my game!
</canvas>
<div id="gamestartscreen" class="gamelayer">
<img src="images/icons/play.png" alt="Play Game" onclick="alert('ceve');"><br>
<img src="images/icons/settings.png" alt="Settings">
</div>
</div>
oto css:
#gamecontainer {
width: 800px;
height: 600px;
background-color: beige;
border: 1px solid black;
position: relative;
margin: 0 auto;
}
.gamelayer {
width: 800px;
height: 600px;
position: absolute;
display: none;
z-index: 0;
}
/* Screen for the main menu (Like Play, Settings, etc.) */
#gamestartscreen {
position: relative;
margin: 0 auto;
}
#gamestartscreen img {
margin: 10px;
cursor: pointer;
}
Czy ktoś mógłby mi powiedzieć, gdzie robię to źle?