Position in css and position in css

Source: Internet
Author: User

Position in css and position in css
I. position syntax and StructurePosition Syntax:Position: static absolute relative

Position parameter:
Static: No special positioning. Objects follow HTML positioning rules.
Absolute: Drag an object out of the Document Stream and use left, right, top, bottom, and other attributes for absolute positioning. Its stack is defined by the css z-index attribute. At this time, the object does not have margins, but still has padding and border
Relative: The object cannot be stacked, but it will be offset in the normal Document Stream Based on the left, right, top, bottom and other attributes.

Ii. Absolute positioning conditions of use

Position: absolute;Position: relativeAbsolute positioning uses the parent-Level Definition of position: relative positioning, child-Level Definition of position: absolute positioning attribute, and child-level use left, right, top or bottom for absolute positioning.

Iii. Summary of absolute css positioning

Absolute positioning if the parent class does not use position: relative, but directly uses position: absolute for absolute positioning, the body label will be used as the parent class, and position: no matter how many layers of DIV structure the absolute definition object is located, it will be dragged out to the <body> level as the parent level (reference level) for absolute positioning.

In absolute positioning, we can use css z-index to define the overlapping sequence of css layers.

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.