distribute space evenly using javascript even though it's better to use flexbox