2013-04-08 59 views
0


我是个网页..其中保证金0汽车不DIV与显示器上工作的工作:表格单元格
这里是我的代码

CSS样式保证金0汽车不DIV与显示器搭配使用:表格单元格

<style> 
    html,body{ 
     height:100%; 
     width:100%; 
    } 
    .wrapper{ 
     background-color:#999; 
     height:500px; 
    } 
    .tableContent{ 
     display:table; 
     height:500px; 
    } 

    .tableContentRow{ 
     display:table-row; 
    } 

    .tableContentCell{ 
     display:table-cell; 
     vertical-align:middle; 
     height:500px; 
    } 

    .loginBox{ 
     height:100px; 
     background-color:#FFF; 
     width:250px; 
     margin:0 auto; 
    } 
</style> 

这里的HTML

<div class="wrapper"> 
    <div class="tableContent"> 
     <div class="tableContentRow"> 
      <div class="tableContentCell"> 
       <div class="loginBox"> 
        <!-- More contents Go HEre --> 
       </div> 
      </div> 
     </div> 
    </div> 
</div>  


的loginBox DIV没有位置的tableContentCell DIV中心请帮忙...

回答

2

表格本身不居中。 检查这个fiddle

.tableContent{ 
    margin:0 auto; 
} 
+0

日Thnx了很多,工作就像魅力 – user1862764 2013-04-08 14:45:40

2

.tableContentCell div上设置一个特定的宽度,你会没事的。

Fiddle

+0

日Thnx了很多,工作就像魅力 – user1862764 2013-04-08 14:39:43

相关问题