Margin update, iOS resize fix

Updated margin rules for consistent behaviour, fixed a bug where
onresize would inappropriately trigger on mobile safari