Can I change the x and y position of a canvas element in Javascript without using CSS? I cannot seem to find anyone who even asks it on the Internet.
EDIT: Can it be done in HTML?
<html>
<title>Testing</title>
<canvas id="main" width="200" height="200" style="border:1px solid #c3c3c3;">
Error: Browser does not support canvas element.
</canvas>
<script type="text/javascript">
var main = document.getElementById("main");
var render = main.getContext("2d");
main.width = 200;
main.height = 200;
main.style.left = 100x;
main.style.top = 100px;
</script>
</html>
1 Answer