Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 绝对div定位_Css - Fatal编程技术网

Css 绝对div定位

Css 绝对div定位,css,Css,问题是.calendardiv停留在页面的顶部,我希望它在页面滚动时移动 .calender{ position:absolute; top:250px; left:600px; width:200px; } .popup{ width:980px; overflow:auto; height:500px; } <div class="calender"></div> <div class="p

问题是
.calendar
div停留在页面的顶部,我希望它在页面滚动时移动

.calender{
    position:absolute;
    top:250px;
    left:600px;
    width:200px;
}   
.popup{
    width:980px;
    overflow:auto;
    height:500px;   
}


<div class="calender"></div>
<div class="popup">
    <input type="text" value="">
    <input type="text" value="">
</div>
.calendar{
位置:绝对位置;
顶部:250px;
左:600px;
宽度:200px;
}   
.弹出窗口{
宽度:980px;
溢出:自动;
高度:500px;
}

我不知道您使用什么作为日历,但这应该可以帮助您开始

位置:绝对位置始终参照父级
位置:相对
如果没有,它将使用
作为相对值,这就是为什么在滚动时它不会下降

我所做的是添加一个
位置:relative容器,即使滚动,也可将日历一直放在文本框旁边

,你应该读一读,它很重要

.container{
位置:相对位置;
}
.压延机{
宽度:200px;
}   
.弹出窗口{
位置:绝对位置;
顶部:20px;
左:0;
宽度:980px;
溢出:自动;
高度:500px;
}




























请尝试以下代码。。。我将位置更改为“固定”,并将div更改为“显示”


文件
.压延机{
位置:固定;
顶部:250px;
左:600px;
宽度:200px;
高度:200px;
背景色:红色;
}
.弹出窗口{
宽度:980px;
溢出:自动;
高度:500px;
}

也许可以尝试
固定的
而不是
绝对的
看看我的答案,但这是一个可能感兴趣的选择