绝对位置不起作用,内部位置固定 [英] Position absolute not working inside position fixed
本文介绍了绝对位置不起作用,内部位置固定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<div id="main" style="position: fixed">
<div id="inner" style="position: absolute">
</div>
</div>
main
和inner
容器均使用position: fixed
.如何使用position:absolute
制作内部容器和使用position:fixed
制作主容器?
Both main
and inner
containers taking position: fixed
. How to make inner container with position:absolute
and main container with position:fixed
?
推荐答案
您是否正在寻找类似的东西?
Are you looking for something similar ?
<div id="main">
<div id="inner">
</div>
</div>
#main {
position: fixed;
width: 100px;
height: 100px;
border: 1px solid #000;
top: 50px;
left: 10px;
}
#inner {
position: absolute;
width: 10px;
height: 10px;
border: 1px solid #f00;
// top: 0px;
// left: 0px;
top: 10px;
left: 10px;
}
这篇关于绝对位置不起作用,内部位置固定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文