No offense: the centering topic is really well covered right now (if you meant to use JS). If you can't resize you're example is really empty in solutions. Plus, depending your target, you can use flexbox and achieve the same with 3 lines of code.
It sounds like you are fixating on the example of centering, where using a physics model to generate positioning and layouts, without CSS or HTML tables, is the goal.