html - 微调器显示在模式的中心而不是网页
问题描述
我有一个引导模态,在模态中我有一个按钮,单击它会显示微调器。微调器不是以网页为中心,而是以模式为中心,即如果我向上滚动模式,微调器也会在上方。无论模态框的位置如何,我都希望我的微调器位于视图的中心。
我的微调器 CSS 如下 -
.spinner-overlay {
position: fixed;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(58, 58, 58, 0.69);
z-index: 10000;
}
.spinner-align {
height: 100%;
padding: 0;
margin: 0;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
}
.spinner-border {
display: inline-block;
width: 2rem;
height: 2rem;
vertical-align: text-bottom;
border: .25em solid currentColor;
border-right-color: transparent;
border-radius: 50%;
-webkit-animation: spin .75s linear infinite;
animation: spin .75s linear infinite;
}
我在我的视图页面中放置了一个 div,如下所示 -
<div class="spinner-overlay" style="display: none;position:fixed;">
<div class="spinner-align">
<div class="d-flex justify-content-center text-center">
<div class="spinner-border text-light" style="width: 3rem; height: 3rem;" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
</div>
</div>
解决方案
在您的课程中尝试以下 CSS .spinner-overlay
:
.spinner-overlay {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100vw;
pointer-events: none;
}
这将使其全屏显示(微调器将根据视口居中)并且还允许用户单击“通过”它。
推荐阅读
- python - 对 Python 中的运算符优先级感到困惑
- https - 如何在使用 fiddler/Charles 时安装自定义客户端证书并信任它
- java - 我需要根据下面给出的规范构建一个家谱。希望它是在Java
- angular - 什么组件可以用来显示大量信息?
- karate - 条件逻辑中驱动的数据未按预期工作
- sql - SQL Server 层次结构,为不同的 ID 选择父节点
- laravel - Laravel 5.7 页面渲染良好,但底部显示 500 错误
- amazon-web-services - 为什么我们在获取 Kinesis Stream 时向 Lambda 授予权限,而不是相反?
- python-3.x - 如何使用逻辑运算符在 pandas 中使用 if 条件
- c++ - C++ 编译时检查微控制器引脚是否已从其他源文件初始化