calculate margin width