You need to put a point inside square , and then give square position: relative . The position of the point will then be relative to the square (i.e. left will be the distance from the left edge of the square.)
#point { position: absolute; top: 50%; left: 50%; } #square { position: relative; border: solid black 1px; height: 100px; width: 100px; position: absolute; top: 50%; left: 50%; }
<div id="square"> <div id="point">+</div> </div>
If you want to use a different angle for positioning, use the right or bottom properties instead of left or top .
If you want to position from the center, do what I suggested with the square, but give it a width and height of 0 . Now the square will be in the center and the point will be located relative to it. Obviously, you are losing width and height, so using percentages for left and top will no longer work.
source share