Dreamweaver(DW)中的div层怎么居中

<div id="Layer1">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','_1','../营养师/3.jpg',1)" onmouseover="MM_nbGroup('over','_1','../营养师/2.jpg','',1)" onmouseout="MM_nbGroup('out')"></a></td>
</tr>
</table>
<div></div>
<div></div>
<div align="center"></div>
</div>

非常感谢。
水平居中。
我一个页面用了很多层,层套层,层套表格。
要使整个页面居中。

Dreamweaver(DW)中的div层居中主要就靠css样式*{margin:0 auto},让整个页面居中。下面是代码案例

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<style type="text/css">
*{margin:0 auto}
#Layer1{border:1px solid #ff0000;width:300px;height:400px;}
#layer2{width:200px;height:100px;border:1px solid #ffff00;}
</style>

<body>


<div id="Layer1" >
  <table border="1" cellpadding="0" cellspacing="0" width="200" height="50">
    <tr>
      <td></td>
    </tr>
  </table>
  <div id="layer2"></div>

</div>


</body>
</html>

代码效果如下:

为了能够方便区分效果,所有表格和层都用了边框颜色来区分

起决定性作用的代码如下图

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2016-10-04
整个页面剧中,你就给最外面的大div设置剧中,设置好宽度,然后margin:0px aotu;本回答被提问者采纳
第2个回答  2009-09-19
找到对应的css文件,在Layer1属性下面加一行margin:0px auto 0px auto或者把原来已经有的margin改成margin:0px auto 0px auto
第3个回答  2009-09-25
<center>
<div id="Layer1">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','_1','../营养师/3.jpg',1)" onmouseover="MM_nbGroup('over','_1','../营养师/2.jpg','',1)" onmouseout="MM_nbGroup('out')"></a></td>
</tr>
</table>
<div></div>
<div></div>
<div align="center"></div>
</div>
</center>
第4个回答  2009-09-20
说清楚是怎么居中,垂直还是水平?