我有一个包含ASP.NET表单的弹出窗口,单击"请求信息"链接,将出现该表单.
但是,具有触发弹出窗口的"请求信息"链接的页面具有大量内容,因此需要滚动才能看到该链接.
div
如果用户滚动阅读内容,我需要始终居中,否则如果他们不滚动弹出窗口仍然显示在屏幕中心.
在div
绝对定位,整个页面宽度960px
与边距设置为0 auto
.
nin*_*nov 16
如果div具有固定的宽度和高度,则使用:(如果width = 120px,height = 80px)
position: fixed;
top: 50%;
left: 50%;
margin-left: -60px; /* negative half of the width */
margin-top: -40px; /* negative half of the height */
Run Code Online (Sandbox Code Playgroud)