html - How to center modal window on view port, no matter where you are located on the page?
问题描述
In my Project I am using a modal window to display a sing Up form.
I have 2 "sign up" buttons on my page. when the top button is pressed the Modal window appears right in the middle of the Users view port whilst when the bottom button is pressed the user has to scroll up in order to access the modal.
Is there a way for the modal to appear in front of the user no matter where he is on the page? If it helps here is the CSS I am using to position the modal (the modal is a div):
.popUp {
width: 30%;
height:600px;
margin:auto;
border: 4px solid black;
background: white;
position: absolute;
top:0;
left:0;
right: 0;
bottom: 0;
display: none;
}
解决方案
推荐阅读
- python - ValueError:无法将大小为 7840000 的数组重塑为形状 (60000,784)
- algorithm - 具有多个循环的算法的时间复杂度
- mongodb - Pymongo 可以通过所有 mongoshell 命令吗
- ruby-on-rails - Rails 模型范围在控制台中返回未定义的方法
- html - Z-Index a Div (0) 在其兄弟 (1) 后面,同时将子级保持在上方 (2) | OwlCarousel 导航箭头仅在悬停时
- sql-server - 如何在 SQL Server 中监视和警告表行值的最大值
- css - 为什么我得到以前的 django 项目的 css 而不是当前的 django 项目?
- ios - 如何在 iOS 上获取相机校准数据?又名 AVCameraCalibrationData
- java - 原因:无法找到请求目标的有效认证路径
- python - google.api_core.exceptions: 403 调用者没有权限