Correctly set the position of child elements