-What is auto?
+auto is self-adapting, auto is the default value for many dimension values, which is calculated automatically by the browser.
+ The sum of the margin, border, padding, and content widths of the block-level elements form the parent element width.
When the Auto property is used, the width of the parent element changes, and the width of the element changes.
The values in auto are the sum of the margin, border, padding, and content widths.
+ But when the element is set to float , the width of the element becomes the contents of the content , the content is open, that is, the so-called parcel .
Overflow | position:absolute | Float:left/right All can produce the package sex, The replacement element is also wrapped.
*|position:relavtive| relative positioning occupies the original position, can not achieve the transformation of the mode, that is, does not have a package.
Therefore, it is not possible to use Width:auto on a package element, so that the width of the element is adaptive to the browser width. As shown
-sometimes set margin:0 auto; not working?
+maigin:0 Auto; The upper and lower margins of the element are 0, and the left and right margins are adaptive to the parent element (body) width, which is centered horizontally around the left and right. If the setting does not work for roughly the following two reasons.
+ (1) No width is set for P, and if p is width, it is not possible to refer to the width of the parent element for auto.
+ (2) p has a wrapper, that is, out of the standard flow, just like the parent object in the standard flow analogy to the surface, the parcel of the element is already heaven. Auto is not available as a reference to the width of the parent element.