注册 登录
编程论坛 ASP.NET技术论坛

页面居中的问题

小肥羊 发布于 2009-10-14 20:33, 1045 次点击
我做的一个网页,想让它里面的东西居中显示,可是就是不行,代码如下:
(主要就是想在<body>中添加text-algin:center,我的用的是windows7系统,和这个有没有关系?)
<html xmlns="http://www. >
<head runat="server">
    <title>万里行鞋店</title>
</head>
<body style="  text-align:center">

    <form id="form1" runat="server"  style="background-color:#E0FFFF; height: 698px; width:90%;">
 
    <div style="text-align:center">
    <h2 style="height: 32px">
        <asp:Label ID="Label1" runat="server" Text="万里行鞋店"></asp:Label>
        </h2>
   
     </div>

     <div style="text-align:left">
     <h4>
     
         <asp:Label ID="Label2" runat="server" Text="一、基本信息"></asp:Label>
     
     </h4>
     </div>
   
   
     <div style="height: 72px; text-align:left">
     <p>
     &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
     
         <asp:Label ID="Label3" runat="server"
             Text="Here is the text for my paragraph. It does't matter how long it is, how many space are between the words or when I decide to hit the return key. It will create a new paragraph only when I begin the tag with another one. "></asp:Label>
     </p>

     </div>
      <div>
     <h4 style="text-align: left">
     
         <asp:Label ID="Label4" runat="server" Text="二、经营范围"></asp:Label>
     
     </h4>
     </div>
     
       <div style="height: 72px; text-align:left">
     <p>
     &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
     
         <asp:Label ID="Label5" runat="server"
             Text="Here is the text for my paragraph. It does't matter how long it is, how many space are between the words or when I decide to hit the return key. It will create a new paragraph only when I begin the tag with another one. "></asp:Label>
     </p>

     </div>
       <div>
     <h4 style="text-align: left">
     
         <asp:Label ID="Label6" runat="server" Text="三、鞋店成员"></asp:Label>
     
     </h4>
     </div>
     
       <div style="height: 72px; text-align:left">
     <p>
     &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
     
         <asp:Label ID="Label7" runat="server"
             Text="Here is the text for my paragraph. It does't matter how long it is, how many space are between the words or when I decide to hit the return key. It will create a new paragraph only when I begin the tag with another one. "></asp:Label>
     </p>

     </div>
       <div>
     <h4 style="text-align: left">
     
         <asp:Label ID="Label8" runat="server" Text="四、鞋店制度"></asp:Label>
     
     </h4>
     </div>
     
       <div style="height: 72px; text-align:left">
     <p>
     &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
     
         <asp:Label ID="Label9" runat="server"
             Text="Here is the text for my paragraph. It does't matter how long it is, how many space are between the words or when I decide to hit the return key. It will create a new paragraph only when I begin the tag with another one. "></asp:Label>
     </p>

     </div>
       <div>
     <h4 style="text-align: left">
     
         <asp:Label ID="Label10" runat="server" Text="五、客户需知"></asp:Label>
     
     </h4>
     </div>
     
       <div style="height: 72px; text-align:left">
     <p>
     &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
     
         <asp:Label ID="Label11" runat="server"
             Text="Here is the text for my paragraph. It does't matter how long it is, how many space are between the words or when I decide to hit the return key. It will create a new paragraph only when I begin the tag with another one. "></asp:Label>
     </p>

     </div>
   
    </form>
</body>
</html>
但是我把它贴到记事本中运行就可以的,会不会visual studio要设置什么啊?

[ 本帖最后由 小肥羊 于 2009-10-14 20:38 编辑 ]
3 回复
#2
jedypjd2009-10-21 19:56
可能跟系统有关系吧
#3
bygg2009-10-21 20:42
如果不行,直接在div外面加
<center>
...
</center>
#4
冯延超2009-10-29 18:49
同意楼上的
1