properly handle margin, and spacing attributes