calculates width after populating element with content