HTML file:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
"Http://www.w3.org/TR/html4/loose.dtd" >
Example of <title>css fixed positioning </title>
<link rel= "stylesheet" style= "Text/css" href= "Test1.css"/>
<body>
<div class= "Div1" >
Content 1
</div>
<div class= "Div1" >
Content 3
</div>
<div class= "Div1" >
Content 4
</div>
<div class= "Div2" >
<div class= "Div1" id= "Special" >
Content 2
</div>
</div>
</body>
CSS file:
. div1{
width:70px;
height:30px;
margin-left:5px;
Background:silver;
Float:left; /* Left FLOAT * *
}
#special {
position:fixed;/* fixed positioning, relative to the upper-left corner of the body, regardless of whether the parent element is out of the standard flow * *
left:40px;
top:100px;
}
. div2{
position:relative;/* relative positioning, separated from the standard flow * *
left:100px;
top:100px;
width:200px;
height:150px;
Background:pink;
Float:left;
}
The effect of the following figure:
This article address: http://www.bianceng.cn/web/Css/201608/50331.htm