Basic knowledge, knowledge

Source: Internet
Author: User

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.