Javascript 如何只在我的另一个div中修复div?
**仅用另一个div修复** 这是我使用的代码。。。 HTML代码Javascript 如何只在我的另一个div中修复div?,javascript,html,css,web,web-site-project,Javascript,Html,Css,Web,Web Site Project,**仅用另一个div修复** 这是我使用的代码。。。 HTML代码 <div class="container"> <div class="fix"> Here fixed content </div> </div> @古鲁 已修复第页上的工作地球仪。 如果要在“容器”中工作,应使用位置:sticky而不是fixed使元素的父容器具有位置:relative <div cla
<div class="container">
<div class="fix">
Here fixed content
</div>
</div>
@古鲁
已修复第页上的工作地球仪。
如果要在“容器”中工作,应使用位置:sticky而不是fixed使元素的父容器具有位置:relative
<div class="parent">
<div class="child"></div>
</div>
.parent {
position: relative;
}
.child {
position: fixed;
margin-top: 30px;
margin-left: 30px;
}
.家长{
位置:相对位置;
}
.孩子{
位置:固定;
边缘顶部:30px;
左边距:30px;
}
<div class="parent">
<div class="child"></div>
</div>
.parent {
position: relative;
}
.child {
position: fixed;
margin-top: 30px;
margin-left: 30px;
}