Please Help - Position flags Force Directed Graph D3

Hi everyone,

Can someone please help me with the code of my force directed graph? The nodes are not positioned with the lines. It works with svg circle elements: I let the force layout do the calculations and use the X and Y coordinates, but when I use it with divs and css left and top properties the flags do no not line up. Can someone help me?

https://codepen.io/chemok78/full/VPMgGx/