javascript - Can I put an HTML button inside the canvas? -
i want make buttons game i'm making real html buttons, need inside canvas.
how go doing this?
given canvas element has transparent content model, may contain fallback elements displayed in event canvas
element unsupported. not displayed if canvas is supported.
you can position html elements relative canvas' parent have buttons "hovering" on canvas. menu element appropriately semantic element render list of controls, depending on context:
html:<div id="container"> <canvas id="viewport"> </canvas> <menu id="controls"> </menu> </div>
css: #container { height: 400px; position: relative; width: 400px; } #viewport { height: 100%; width: 100%; } #controls { bottom: 0; left: 0; position: absolute; width: 100%; }
Comments
Post a Comment