Answer the question
In order to leave comments, you need to log in
Set X, Y coordinates with divs?
Good afternoon!
How to set XY coordinates to an existing div ?
Here is the HTML code:
<div class="game-area">
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
</div>
Answer the question
In order to leave comments, you need to log in
Firstly, canvas is used for such purposes and there all objects already move along coordinates, here's a tip, don't do nonsense and read books on gaming topics on the web.
But if you need to use divs then you need to use position: absolute and its surrounding properties(top, left)
if for example in svg foreignObject - then for div you can set coordinates
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question