4.3 [CSS-Level1-2008] Section 4.1.2, Horizontal formatting
The [CSS-Level1-2008] specification states:
Section 4.1.2: If exactly one of 'margin-left', 'width' or 'margin-right' is 'auto', the UA will assign that property a value that will make the sum of the seven equal to the parent's width. If none of the properties are 'auto', the value of 'margin-right' will be assigned 'auto'. If more than one of the three is 'auto', and one of them is 'width', then the others ('margin-left' and/or 'margin-right') will be set to zero and 'width' will get the value needed to make the sum of the seven equal to the parent's width. Otherwise, if both 'margin-left' and 'margin- right' are 'auto', they will be set to equal values. This will center the element inside its parent. If 'auto' is set as the value for one of the seven properties in an element that is inline or floating, it will be treated as if it were set to zero.
All Document Modes (All Versions)
Determining whether the margin-left property or the margin-right property is assigned to
auto when neither property is set to
auto depends on the writing direction of the block (RTL or LRT). This behavior is in accordance with the [CSS-Level2-2009] specification.