如何使网页居中(在任何分辨率下)?在线急等。。。
我是在1024*768的分辨率下做的网页,在800*600及1280*800的分辨率下显示的网页不是不能全屏就是靠左显示。搜了好多种方法还是不能解决,请大家赐教!
------解决方案--------------------把内容塞进一个table中,然后align= "center " 或者首尾 <p align= "center "> </P>
------解决方案--------------------html,body{
text-align:center;
}
------解决方案-------------------- <table width=100%>
<tr>
<td align=center>
<table width=760 border=0 cellspacing=0> <tr>
<td>
此为你的内容。
</td>
</tr>
</table>
</td>
</tr>
</table>
////////////////////
www.gisshop.cn/blog/blog.aspx
------解决方案-------------------- <div style= "width:770px;margin:auto "> </div>
------解决方案--------------------body{
text-align:center;
}
------解决方案--------------------我都是这样做的
<body>
<center>
....(你的页面内容)
</center>
</body>
------解决方案--------------------把 <form id= "Form1 " style= "POSITION: static " method= "post " runat= "server ">
改为
<form id= "Form1 " method= "post " runat= "server ">
有style= "POSITION: static "这个,都去掉,否则没用
然后像上面说的,在最外面加个 <body> </body> 之间,加
<table width= "100% " border= "0 " cellspacing= "0 " cellpadding= "0 " align= "center ">
<tr>
<td>
你 <body> </body> 之间的代码
</td>
</tr>
</talbe>
------解决方案--------------------内容确实应放在tabl,至少3列,然后td的宽度不要使用像素,而使用百分比
------解决方案--------------------唉,“网页居中”结果全都顶部对齐,html还没过关搞asp.net就难度大了。
你的页面:
<%@ Register TagPrefix= "uc1 " TagName= "ControlLeft2 " Src= "ControlLeft2.ascx " %>
<%@ Page language= "c# " Codebehind= "WebForm1.aspx.cs " AutoEventWireup= "false " Inherits= "MyWeb.WebForm1 " smartNavigation= "True " description= "首页 "%>
<html>
<head>
<title> WebForm1 </title>
<meta content= "Microsoft Visual Studio .NET 7.1 " name= "GENERATOR ">
<meta content= "C# " name= "CODE_LANGUAGE ">
<meta content= "JavaScript " name= "vs_defaultClientScript ">
<meta content= "http://schemas.microsoft.com/intellisense/ie5 " name= "vs_targetSchema ">
</head>
<body bgcolor= "#ffffff " ms_positioning= "FlowLayout " leftmargin= "0 " rightmargin= "0 "
topmargin= "0 " bottommargin= "0 ">
<form id= "Form1 " method= "post " runat= "server ">
<table width= "100% " height= "100% ">
<tr>
<td align= "center " valign= "middle ">
...放你的控件