效果图
1.html
<div id="box"></div>
<div id="guang">广告</div>
2.利用fixed
绝对定位的元素,相对于浏览器窗口进行定位。
#box{height: 2000px;
width:80%;
background: red;
margin: auto;}
#guang{height: 100px;
width: 100px;
background: blue;
position:fixed;
bottom: 50%;
left: 80%;}