日期:2014-05-17  浏览次数:20748 次

层里面放一个表格,层的align为居中,可是表格的align为左,为何表格中还是居中呀,请见代码
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
<style   type= "text/css ">
<!--
body{text-align:center}
#Layer1   {
left:auto;
top:0px;
width:788px;
height:172px;
z-index:1;
background-color:   #CCCCCC;
background-position:   center;
clear:   both;
right:   auto;
</style>
}
-->
</style>
</head>

<body>
<div   align= "left "   id= "Layer1 ">
    <table   width= "100% "   border= "1 "   align= "left "   cellpadding= "0 "   cellspacing= "0 ">
        <tr>
            <td   colspan= "2 "> fsafsdafsadfsadfasdf </td>
            <td   width= "47% "> asdfsadfsadf </td>
        </tr>
        <tr>
            <td   width= "36% "> asdfsadfsadf </td>
            <td   width= "17% "> asdfsdaf </td>
            <td> sadf </td>
        </tr>
    </table>
</div>
</body>
</html>

------解决方案--------------------
body{text-align:center} 因为有这句
如果你不想table里的内容继承这个属性可以在这句下面加一句

table{text-align:left}

都不知道你想干嘛了~ 呵