<title>Css–position</title> Css–positiontable of Contents
- Static
- Fixed
- Absolute
- Relative
Static
Default positioning mode top and left do not work
Fixed
Move without scrolling with the page is generally a navigational element
Absolute
After setting the current position to absolute, then his position is relative to his father.
float: left; left: 50px; Relative to the father is 50px top: 50px;
Similar to this
<div id="Id1"> <div id="Id2"> # Absolute </div></div>
Relative
The opposite is where he was originally supposed to be, such as:
#div1 {width : 800px; height : 800px; background : Green; position : absolute;} #div2 {width : 200px; height : 200px; background : Red; float : Left; left : 50px; top : 50px; position : relative;}
<divid="Div1"> <divid="Div2"></ Div></div>
Where he was supposed to be.
Now the position is 50px from the left .
CSS--position