The absolute position and fixed in common and differences

Common  

1. Change the line elements within the presentation, display is set to block   

2. Let the elements out of the ordinary flow, does not occupy space   

3. The default will cover the elements of unlocated

difference   

absolute "root element" is disposed, and fixed "root element" holding position of the browser window   

When scrolling the page, the distance between the fixed elements of the browser window is unchanged

 

 

Positioning type specifies elements: position   

Any element can be located, but the absolute or fixed element will generate a block-level box, regardless of what type of the element itself. The relative positioning of the elements will be relative to its default position offset in the normal stream.  

absolute: generating absolute positioning element relative to the first parent element is positioned outside the static positioning. Position of the element by "left", "top", "right" and "bottom" predetermined attribute.   

fixed: generating element absolute positioning, relative to the browser window positioning. Position of the element by "left", "top", "right" and "bottom" predetermined attribute.   

relative: generating element relative positioning, positioning relative to its normal position.   

static: the default value. No positioning element appears in the normal stream.   

inherit: specified value of the position should inherit the property from the parent element.

Guess you like

Origin www.cnblogs.com/miluluyo/p/11128389.html