怎样让页面上的东西居中显示啊? <body ms_positioning="FlowLayout"…… 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <div align="center" width="100%">...</div>或者<table aligh="center" width="100%">...</table> 你应该做一个Table,把所有东西都放在Table中,然后再设置Table的宽度为100%,行居中。 <center>.....</center>no absolute position 将所有的控件的绝对位置样式都去掉,就是style中的东西,再将<body ms_positioning...中的ms_positioning及后面的东西去掉,只剩<body>最后再用<div align=center>......</div> 创建一个一行一列的table(web窗体中的),边框大小设置为0,宽度选为100 百分比<td align="center">XXXXXX</td>XXXXXX为你想居中的控件 用Div肯定可以的,看看你有什么东东和你的Div冲突 <div align="center">xxxx</div> 先修改body中的 ms_positioning属性,然后再用div 或者table控制居中 <body><div align="center"><div></body> <asp:label id="Label1" style="Z-INDEX: 124; LEFT: 240px; POSITION: absolute; TOP: 147px; TEXT-ALIGN: center" runat="server" Font-Names="Verdana" Font-Size="9pt" Width="129px">Care Recipient ID</asp:label> <asp:label id="Label1" style="Z-INDEX: 124; LEFT: 240px; POSITION: absolute; TOP: 147px; TEXT-ALIGN: center" runat="server" Font-Names="Verdana" Font-Size="9pt" Width="129px">Care Recipient ID</asp:label> <asp:label id="Label1" style="Z-INDEX: 124; LEFT: 240px; POSITION: absolute; TOP: 147px; TEXT-ALIGN: center" runat="server" Font-Names="Verdana" Font-Size="9pt" Width="129px">Care Recipient ID</asp:label> 我的代码是这样的,他就是不能居中。 <body MS_POSITIONING="GridLayout"> <div align ="center"> <form id="Form1" method="post" runat="server"> <FONT face="宋体"> <asp:TextBox id="TextUser" style="Z-INDEX: 101; LEFT: 312px; POSITION: absolute; TOP: 224px" runat="server" Width="144px" Height="18px"></asp:TextBox> <asp:TextBox id="TextPass" style="Z-INDEX: 102; LEFT: 312px; POSITION: absolute; TOP: 264px" runat="server" Width="144px" TextMode="Password" Height="18px"></asp:TextBox> <asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 480px; POSITION: absolute; TOP: 264px" runat="server" Width="41px" Text="确定" Height="24px"></asp:Button> <asp:Image id="Image1" style="Z-INDEX: 104; LEFT: 256px; POSITION: absolute; TOP: 96px" runat="server" Width="256px" Height="64px" ImageUrl="logo.jpg"></asp:Image> <asp:Label id="Label1" style="Z-INDEX: 105; LEFT: 240px; POSITION: absolute; TOP: 176px" runat="server" Width="328px" Height="24px" Font-Bold="True">Welcome to Polymorph Storage System</asp:Label> <asp:Label id="Label2" style="Z-INDEX: 106; LEFT: 256px; POSITION: absolute; TOP: 344px" runat="server" Width="280px" Font-Size="X-Small" Font-Underline="True">Copyright 2000-2004 Polymorph Work Group </asp:Label></FONT> </form> </div> </body> <div align="center">是用于调节div内元素相对div的位置,而不是用于调节div在页面上的位置。你要让div显示在中间,有两种方法:1。设置div的style属性:如style="LEFT: 500px; WIDTH: 78px; POSITION: absolute; TOP: 500px; HEIGHT: 59px",调节top和left属性2。将div放在一个table或另一个div中,设置table的align属性,如下:<table style="WIDTH: 300px; HEIGHT: 300px"> <tr> <td align="center"> <div align="center" style=" LEFT: 500px; WIDTH: 78px; TOP: 500px; HEIGHT: 59px"> <INPUT style="WIDTH: 13px; HEIGHT: 20px" type="checkbox" value="show" id="Checkbox2" title="show" name="Checkbox2" runat="server"> </div> </td> </tr></table> 把这些绝对定位的代码都去掉啊!style="Z-INDEX: 101; LEFT: 312px; POSITION: absolute; TOP: 224px 这样就可以了:<body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server" onsubmit="return Charactor_Check();"> <table id="tbl" align="center" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="middle"> <asp:Image id="Image1" runat="server" Width="256px" Height="64px" ImageUrl="logo.jpg"></asp:Image> </td> <tr> <td align="middle"> <asp:Label id="Label1" runat="server" Width="328px" Height="24px" Font-Bold="True">Welcome to Polymorph Storage System</asp:Label> </td> </tr> <tr> <td align="middle"> <asp:TextBox id="TextUser" runat="server" Width="144px" Height="18px"></asp:TextBox> </td> </tr> <tr> <td align="middle"> <asp:TextBox id="TextPass" runat="server" Width="144px" TextMode="Password" Height="18px"></asp:TextBox> <div style="position:absolute;"><asp:Button id="Button2" runat="server" Width="41px" Text="确定" Height="24px"></asp:Button></div> </td> </tr> <tr> <td align="middle"> </td> </tr> <tr> <td align="middle"> <asp:Label id="Label2" runat="server" Width="280px" Font-Size="X-Small" Font-Underline="True">Copyright 2000-2004 Polymorph Work Group </asp:Label></FONT> </td> </tr> </table> </form> </body> 使用timer控件网上上老显示网页上有错误 导致网页数据无法刷新 Web.config里的密码配置问题 html 转 pdf 的控件 求一高难度存储过程。。。。。 实现对iframe的src赋值 鼠标滑过获取不同内容 如何将gridview中的部分内容导出到Excel??急!!! 急!有关配置的问题在线等待 求救学习asp.net+jquery UI+ajax +ashx+json csdn的管理员请看 求教动态绑定删除列的问题! C#为脚本的ASP.Net网页上,如何显示一幅图片?
...
</div>或者<table aligh="center" width="100%">
...
</table>
再将<body ms_positioning...中的ms_positioning及后面的东西去掉,
只剩<body>
最后再用<div align=center>......</div>
<td align="center">XXXXXX</td>
XXXXXX为你想居中的控件
xxxx
</div>
<body MS_POSITIONING="GridLayout">
<div align ="center">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<asp:TextBox id="TextUser" style="Z-INDEX: 101; LEFT: 312px; POSITION: absolute; TOP: 224px"
runat="server" Width="144px" Height="18px"></asp:TextBox>
<asp:TextBox id="TextPass" style="Z-INDEX: 102; LEFT: 312px; POSITION: absolute; TOP: 264px"
runat="server" Width="144px" TextMode="Password" Height="18px"></asp:TextBox>
<asp:Button id="Button2" style="Z-INDEX: 103; LEFT: 480px; POSITION: absolute; TOP: 264px" runat="server"
Width="41px" Text="确定" Height="24px"></asp:Button>
<asp:Image id="Image1" style="Z-INDEX: 104; LEFT: 256px; POSITION: absolute; TOP: 96px" runat="server"
Width="256px" Height="64px" ImageUrl="logo.jpg"></asp:Image>
<asp:Label id="Label1" style="Z-INDEX: 105; LEFT: 240px; POSITION: absolute; TOP: 176px" runat="server"
Width="328px" Height="24px" Font-Bold="True">Welcome to Polymorph Storage System</asp:Label>
<asp:Label id="Label2" style="Z-INDEX: 106; LEFT: 256px; POSITION: absolute; TOP: 344px" runat="server"
Width="280px" Font-Size="X-Small" Font-Underline="True">Copyright 2000-2004 Polymorph Work Group </asp:Label></FONT>
</form>
</div>
</body>
上的位置。
你要让div显示在中间,有两种方法:
1。设置div的style属性:如style="LEFT: 500px; WIDTH: 78px; POSITION: absolute; TOP: 500px; HEIGHT: 59px",调节top和left属性
2。将div放在一个table或另一个div中,设置table的align属性,如下:<table style="WIDTH: 300px; HEIGHT: 300px">
<tr>
<td align="center">
<div align="center" style=" LEFT: 500px; WIDTH: 78px; TOP: 500px; HEIGHT: 59px">
<INPUT style="WIDTH: 13px; HEIGHT: 20px" type="checkbox" value="show" id="Checkbox2" title="show" name="Checkbox2" runat="server">
</div>
</td>
</tr>
</table>
<form id="Form1" method="post" runat="server" onsubmit="return Charactor_Check();">
<table id="tbl" align="center" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="middle">
<asp:Image id="Image1" runat="server" Width="256px" Height="64px" ImageUrl="logo.jpg"></asp:Image>
</td>
<tr>
<td align="middle">
<asp:Label id="Label1" runat="server" Width="328px" Height="24px" Font-Bold="True">Welcome to Polymorph Storage System</asp:Label>
</td>
</tr>
<tr>
<td align="middle">
<asp:TextBox id="TextUser" runat="server" Width="144px" Height="18px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="middle">
<asp:TextBox id="TextPass" runat="server" Width="144px" TextMode="Password" Height="18px"></asp:TextBox>
<div style="position:absolute;"><asp:Button id="Button2" runat="server" Width="41px" Text="确定" Height="24px"></asp:Button></div>
</td>
</tr>
<tr>
<td align="middle">
</td>
</tr>
<tr>
<td align="middle">
<asp:Label id="Label2" runat="server" Width="280px" Font-Size="X-Small" Font-Underline="True">Copyright 2000-2004 Polymorph Work Group </asp:Label></FONT>
</td>
</tr>
</table>
</form>
</body>