Absolute positioning--absolution

Source: Internet
Author: User

<!--Absolute Positioning:
when the Position property value is set to absolution, the absolute positioning of the element is turned on
features of the absolution:
1. Absolute positioning is turned on, leaving elements out of the document
2. But absolute positioning is turned on, and if no offset is set, the position of the element is not changed
3. Absolute positioning is relative to the location of the nearest ancestor that opened the position (in general, the absolute positioning of the child element opens the relative positioning of the parent element )
If all ancestor elements are not positioned, they will be positioned relative to the browser window
4. Absolute positioning causes one element to ascend one level
5. Absolute positioning changes the nature of the element
(1) inline elements become block elements
(2) The width and height of the block elements will be open by default
-

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>postion</title>
<style>
. box1{
width:200px;
height:200px;
background:red;
}
. box2{
width:200px;
height:200px;
Background:yellow;
Position:absolute;
left:200px;
top:0px;
}
. box3{
width:400px;
height:400px;
Background:green;
position:relative;
/* Turn on relative positioning of box4 */
}
. box4{
width:300px;
height:300px;
Background:papayawhip;
}
. sp{
width:200px;
height:200px;
Background:cyan;
Position:absolute;
}
</style>
<body>

<div class= "Box1" ></div>
<div class= "Box3" ><div class= "box4" ><div class= "Box2" ></div></div></div>

<span class= "SP" > this is a span</span>
</body>

Absolute positioning--absolution

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.