On the position usage of css, cssposition

Source: Internet
Author: User

On the position usage of css, cssposition

In css, the position attribute has four values available: static (default), absolute, relative, and fixed.

Relative: relative positioning (relative to its position in the conventional stream, retain its original position)

Absolite:

1. Positioning of its own contained blocks;
2. Search for inclusion block rules: Search for ancestor elements from the Internet, and find the inner margin boundary of the First Ancestor element whose position is not static modified is the inclusion block of the current absolute positioning element; if not, it is located relative to html;
3. Completely out of the document stream;
4. Change the value of display to inline-block;
5. Do not shorten the row box

Fixed:

The only difference between a file stream and absolute is that the absolute element determines the location based on the latest positioning context, while fixed always determines the Location Based on the browser. It does not move even if the window is rolling.

Speaking of position, let's talk about [Z-index] (vertical positioning)

The default value of Z-index is 0. In this case, the latter will overwrite the former. To change the hierarchical relationship between elements, you must change the Z-index value, the higher the Z-index value, the higher the priority.

 

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.