calculate border width