让一个DIV在BODY的中央
<head runat="server"> <title></title> <style type="text/css"> body { height:100%; background-color:#F9F8F8; padding:0px; } #login { background-color:White; height:300px; margin-left:0px; margin-right:0px; margin-top:auto; margin-bottom:auto; } </style></head><body> <div id="login"> nihao </div> </body></html>
<head runat="server"> <title></title> <style type="text/css"> body { height:100%; background-color:#F9F8F8; padding:0px; } #login { background-color:White; height:300px; margin-left:0px; margin-right:0px; margin-top:auto; margin-bottom:auto; position:absolute;top:50%;margin-top:-150px; width:100%; } </style></head><body> <div id="login"> nihao </div> </body></html>
[解决办法]