Reputation: 29
I am simply trying to place buttons next to my canvas over each other but I am simply not able to do it.
<div class="wrapper" style="position: relative">
<canvas id="c"></canvas>
<div class="controls" style="position: relative">
<button onclick="test()">test</button>
<button onclick="test2()">test2</button>
</div>
</div>
this is my html part. The canvas height and width are created dynamically in javascript but now I'd like to have the buttons next to the canvas. But for some reason they are always under the canvas. I have tried to place the canvas inside a div with a static height and width but that also didn't work. If I remove the wrapper and the controls div, I can set one button manually to position: absolute
and that works. But for some reason I can't get it right. I obviously don't completely understand how to handle the elements so help would be appreciated.
Upvotes: 0
Views: 1067
Reputation: 66
with the canvas in its own div and the buttons in a div use:
display: inline-block; or float: left; that might work.
Upvotes: 1