Basic knowledge, knowledge
Position attribute: Specifies the positioning type of the element. That is, the elements are displayed anywhere on the page.
①Absolute: Absolute positioning; separated from the layout of the Document Stream, the remaining space is filled by the elements behind it. The starting position of the positioning is the closest parent element (postion is not static); otherwise, it is the Body document.
②Relative: Relative positioning. Without the layout of the Document Stream, you only need to change the location of the file stream and leave the blank area in the original location of the Document Stream. The starting position of the positioning element.
③Fixed: Fixed positioning; similar to absolute, but does not change the position as the scroll bar moves.
④Static: Default value; default layout.
The position attribute only disconnects the element from the document stream. to display the element as expected, use the following attributes (position: static does not support these attributes ):
① Left: the number of pixels inserted to the left of the element, and the number of pixels moved to the right of the element.
② Right: the number of pixels inserted to the right of the element, so that the element moves to the left.
③ Top: the number of pixels inserted to the top of the element, and the number of pixels moved down by the element.
④ Bottom: indicates how many pixels are inserted to the bottom of the element and how many pixels are moved up by the element.
The value of the preceding attribute can be negative, in px.
CSS top attributes
The top attribute specifies the top edge of the element. This attribute defines the offset between the upper and outer margin boundary of a positioning element and the upper boundary of the contained block.
Note: If the value of the "position" attribute is "static", setting the "top" attribute will not produce any effect.
| Value |
Description |
| Auto |
Default value. Calculate the position of the top edge in a browser. |
| % |
Set the upper position as a percentage of elements. Negative values can be used. |
| Length |
Use pixels, cm, and other units to set the top position of the element. Negative values can be used. |
| Inherit |
Specifies that the top attribute value should be inherited from the parent element. |
Set "margin: auto;" for all block-level elements to align with the parent container, and set "text-align: center;" for the parent container to center the label button.
Observe whether the font-weight feature is invalid for the H1 tag or the default font-weight: bold; attribute is used.