[CSS layout. 2] absolute and relative positioning

Source: Internet
Author: User

Absolute
, CSS
Statement: Position: absolute;
Top, right, bottom, left (hereinafter referred to as trbl) are located. If no trbl is set, the original vertices of the parent level are marked as the original vertices by default. If you set trbl and
If the position attribute is not set for the parent level, the current absolute locates the position based on the original vertex in the upper left corner of the browser. The position is determined by trbl.

 

In general, when the webpage is centered, absolute is prone to errors, because the webpage is always automatically adapted with the resolution, while absolute uses the browser's upper left corner as the original
Point, the location is not changed due to resolution changes. Many people make mistakes in this case. The characteristics of a webpage are similar to those of relative, but there are some essential differences.

Relative
In css: Position: relative;
He means absolute relative positioning. He refers to the original vertices of the parent level as the original vertices, and the original vertices of the body as the original vertices without a parent level for positioning with trbl, when the parent class has CSS such as padding
Attribute, the original vertex of the current level is located according to the original vertex of the parent level content area.

Sometimes we also need to rely on Z-index to set the upper and lower relations of the container. The larger the value, the higher the upper the corner. The value range is a natural number. Of course, it should be noted that the parent-child relationship cannot be set with Z-index. The parent-child relationship must be set at the parent level.

Related Article

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.