CSS Positioning and four kinds of applications

position:
. 1, static automatic positioning (positioning default mode), not through the top \ left \ bottom \ right change element positions, typically positioned to clear.
2, relative relative positioning, positioning (offset with respect to their own, without departing from the standard flow, continue to occupy the original position) with respect to the flow of the original document
3, absolute absolute positioning, relative to an already positioned thereon parent elements positioning (from the standard flow, does not take up the position, the left and right margin auto failure)
(1) no parent element is positioned to the positioning reference document
(2) positioning a parent element, parent element positioned with reference places
4, fixed fixed positioning , relative to the browser window positioning

* If the child is absolute positioning absolute, father to use relative positioning relative.
# Absolute positioning absolute box centered horizontally and vertically
position: absolute; left: 50%; Top: 50%
margin-left: -50px; half their width;
margin-Top: -50px; half their height

Guess you like

Origin www.cnblogs.com/lp-web/p/12052558.html