HTML and CSS learning day9

  • Positioning
    Positioning = positioning mode + edge offset
    staticStatic positioning
    relativeRelative positioning
    absoluteAbsolute positioning
    fixedFixed positioning

The edge offset has top bottom left right

1. Static positioning static (understand) the
default positioning method of the element has no meaning of positioning, as the standard flow element has no edge offset. It is rarely used
. 2. The relative
relative positioning position is moved and the original position is
retained. 3.
Absolute absolute positioning if there is no parent element or no parent element Positioning is based on the browser as the positioning mobile location

If the parent element is positioned, move the position based on the nearest parent element with positioning

Absolute positioning no longer occupies the original position

Son and father
Insert picture description here

4.Fixed
fixed positioning is subject to the browser visual window. It
has nothing to
do with the parent element. It does not follow the scroll bar
and does not occupy the original position after being fixed.

5.sticky
positioning

Guess you like

Origin blog.csdn.net/weixin_42778611/article/details/114925266