In the following sections, these terms are used:
Similar to calculating the width of a table cell using the automatic table layout algorithm. In general, the user agent attempts to find the minimum element width that will contain the content and wrap to multiple lines only if wrapping cannot be avoided.
The place where an element’s edge would have been placed if its
The equation that governs the layout of these elements is:
left + margin-left + border-left-width + padding-left + width + padding-right + border-right-width + margin-right + right = width of containing block
The steps used to determine layout are:
If all of
auto, first reset any
auto values for
0. Then, if
left to the static position and apply the rule given in step 3c. Otherwise, set
right to the static position and apply the rule given in step 3a.
If none of
auto, pick the rule that applies from the following list:
margin-right are set to
auto, solve the equation under the additional constraint that the two margins get equal values.
If only one of
margin-right is set to
auto, solve the equation for that value.
If the values are overconstrained (none is set to
auto), ignore the value for