如何为集中浮动确认对话框设计CSS? [英] How to design a CSS for a centered floating confirm dialog?
本文介绍了如何为集中浮动确认对话框设计CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在寻找一种显示确认对话框的方法,该对话框总是以页面为中心,并浮动在页面上。
I'm looking for a way to display a confirm dialog that's always centered on the page, and floating over the page.
尝试了,始终居中,因为位置是固定的:
Tried that, but it's not 'always centered' at all, since the position is fixed:
.Popup
{
text-align:center;
position: absolute;
bottom: 10%;
left: 27%;
z-index:50;
width: 400px;
background-color: #FFF6BD;
border:2px solid black;
}
有什么想法吗?
感谢
Any idea? Thanks
推荐答案
尝试使用 CSS
#centerpoint {
top: 50%;
left: 50%;
position: absolute;
}
#dialog {
position: relative;
width: 600px;
margin-left: -300px;
height: 400px;
margin-top: -200px;
}
<div id="centerpoint">
<div id="dialog"></div>
</div>
#centerpoint 应为对话框
的容器div。 strong> #centerpoint DIV应位于正文元素内部或没有 position:relative; 属性
Note that the #centerpoint DIV should be inside the body element or inside elements that don't have a position: relative; property
这篇关于如何为集中浮动确认对话框设计CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文