CSS Positioning Relative,absolute

Source: Internet
Author: User

Transfer from http://www.cnblogs.com/Jerry-Chou/archive/2011/11/02/2233094.html

1. First explain the flow of the document

is a mechanism of HTML, block elements of a single row (such as Div), inline elements do not wrap (a tag, img tag);

2. Several positioning methods

2.1 Static

HTML default positioning method, subject to document flow (flow), adaptive, do not need us to set.

2.2 Relative

Relative positioning, relative to their original position (reference is their own), you can use bottom,top,left,right and other positioning, but subject to the flow of documents, still occupy their original position;

2.3 Absolute

Absolute positioning, the reference is the ancestor has had the position:relative or the Position:absolute element, may use the bottom,top,left,right and so on localization, but the absolute localization will remove from the document flow, is the original occupied position will be canceled;

2.4 Fixed

Absolute references are the last-positioned ancestors (static not counted), if the reference to the element is a document, it is implemented using Position:fixed;

2.5 float

---restore content ends---

CSS Positioning Relative,absolute

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.