The understanding and application of three kinds of position in CSS format and layout

Source: Internet
Author: User

First position relationship: position:fixed lock Position (relative to the location of the entire browser), commonly used in the lower right corner of the major websites or in other locations of small ads.

If you need to adjust the lock position, you need to use the following way: <div style= "width:300px; height:300px; position:fixed; top:0px, left:0px, right:0px, bottom:0px"></div>

Second position relationship: Position:absolute absolute Position (relative to parent element-browser, absolute location of ancestor)

(1) There is no absolute at the outermost, then when the div is adjusted relative to the browser, (2) The outermost is absolute, then the div changes relative to the outermost boundary when adjusting.

If you need to adjust the absolute position, you need to use the following way: <div style= "width:300px; height:300px; Position:absolute; top:0px, left:0px, right:0px, bottom:0px"></div>

Third position relationship: Position:relative relative position (relative to where it should appear)

If you need to adjust the relative position, you need to use the following way: <div style= "width:300px; height:300px; position:relative; top:0px, left:0px, right:0px, bottom:0px"></div>

The understanding and application of three kinds of position in CSS format and layout

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.