<div id="main" style="position: fixed">
<div id="inner" style="position: absolute">
</div>
</div>
Both main
and inner
集装箱取走position: fixed
。内胆的制作方法position:absolute
和主容器position:fixed
?
你需要定义top
, right
, bottom
or left
使用时的属性fixed
, relative
or absolute
定位在元素上。
#main {
background: #000;
position: fixed;
height: 300px;
width: 200px;
left: 20px;
top: 10px;
}
#inner {
background: #f00;
position: absolute;
height: 100px;
width: 100px;
left: 10px;
top: 10px;
}
<div id="main">
<div id="inner">
</div>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)