1. A system for collapsing margins of objects in a document, the system comprising: a processing unit; and a computer storage media having instructions executable by the processing unit stored thereupon configured to provide a collection component for collecting object information of objects in the document and associated object margins in a margin neighborhood of the objects and a margin component for collapsing the margins in a single formatting pass for placement of the objects in the document the single formatting pass comprising parsing the objects in the margin neighborhood until an end of the margin neighborhood is reached, a cleared object is encountered, or a float object is encountered that has no parent in the margin neighborhood, collapsing margins detected during the parsing of the objects, assigning top space to each non-empty object having a first top margin, and assigning zero top space to one or more child objects of the non-empty object, and collapsing margins for all objects preceding an empty object having no preceding parent in the margin neighborhood, collapsing a top margin of the empty object, combining margins preceding the empty object with a top margin of the empty object and one or more margins inside the empty object, and collapsing the margins of any children objects of the empty object, and placing parsed objects in the document.