Calculate module header and footer width on the fly