CSS position attribute
By using the position attribute
, We can select different types of positioning in 4, which will affect the method of generating element boxes.
Meaning of the position property value:
Static
The element box is generated normally. Block-level elements generate a rectangular box. As part of the Document Stream, one or more row boxes are created for the element in the row and placed in the parent element.
Relative
The element box offsets a certain distance. The element remains in the shape before its position, and its original space remains.
Absolute
The element box is completely deleted from the document stream and located relative to its contained block. The inclusion block may be another element in the document or an initial inclusion block. The space occupied by the element in the normal Document Stream will be disabled
It seems that the element does not exist. After the element is located, a block-level box is generated, regardless of the type of box it generated in the normal stream.
Fixed
The element box is similar to setting position to absolute, but its contained block is the window itself.
Tip:
Relative positioning is actually considered part of the normal stream positioning model, because the position of an element is relative to its position in the normal stream.
.