gpt4 book ai didi

asp.net - 将 div 对齐到与 asp.net 中的表格标签重叠的页面中心

转载 作者:太空宇宙 更新时间:2023-11-04 14:07:30 25 4
gpt4 key购买 nike

我想在页面中央使用 DIV 显示一个表单。当显示表单时,背景页面应该被禁用。这是我的 CSS:

.formLayout {
background-color: #f3f3f3;
border: solid 1px #a1a1a1;
padding: 10px;
width: 300px;
margin: 0 auto;
}

.formLayout Label, .formLayout TextBox {
display: block;
width: 120px;
float: left;
margin-bottom: 10px;
}

.formLayout label {
text-align: right;
padding-right: 20px;
}

这是我的标记:

<div class="formLayout">
<asp:Label ID="Label2" runat="server" Text="Enter the Load Code:"></asp:Label>
<asp:TextBox ID="inputLoadCode" runat="server"></asp:TextBox>
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;
<asp:Button ID="Button1" runat="server" Text="Submit" />
&nbsp;
<asp:Button ID="Button2" runat="server" Text="Cancel" />
</div>
<table cellspacing="2" id="Components" width="100%">.........

最佳答案

你可以尝试这样的事情:

<div id="dv-modal">
<div id="dv-bg"></div>
<div id="dv-form"></div>
</div>

还有CSS:

        #dv-modal
{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index:1000;
}

#dv-bg
{
position: absolute;
z-index: 0;
width: 100%;
height: 100%;
}

#dv-form
{
position: relative;
width: 100px;
height: 100px;
background: gray;

/*CENTER ON THE SCREEN*/
top: 50%;
left: 50%;
margin-left: -50x;
margin-top: -50px;
}

这将阻止后面的任何内容...

关于asp.net - 将 div 对齐到与 asp.net 中的表格标签重叠的页面中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21019127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com