CSS positioning: Absolute positioning (absolute)

Source: Internet
Author: User

The concept of absolute positioning
1. Use an absolutely positioned box to offset its "most recent" "ancestor Element" of "already positioned" as the baseline. If there are no ancestor elements that have been positioned, then the browser's window can be used as a benchmark for positioning.
2. Decide the position of the box to detach from the standard flow.

<HTML> <Head> <Metahttp-equiv= "Content-type"content= "text/html;CharSet=utf-8″/> <title>Untitled Document</title> <styletype= "Text/css">Body{margin:15px;font-family:Arial;font-size:12px; }. Father{Background-color:#ffff99;Border:1px solid #000000;padding:20px; }. Father Div{Background-color:#00ff00;padding:10px;Border:1px dashed #000000; }#block2{position:Absolute; Left: -;Top: -; } </style> </Head> <Body> <Divclass= "Father"> <Div>Box-1</Div> <DivID= "Block2″>Box-2</Div> <Div>Box-3</Div> </Div> </Body> </HTML>

CSS positioning: Absolute positioning (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.