本页面由 Flash 保存计划 从 Internet Archive 存档还原 · 快照 2010-06-11 · 原址 http://www2.flash8.net/teach/7257.htm ← Flash 保存计划

如何设定div层的对齐方式

作者:firefly_hy   类型:闪吧BBS   来源:闪吧个人空间

  

在Dreamwaver中设计div层的时候,属性面板没有像表格一样给出水平、垂直对齐方式的选项,使用下面的代码可以做到:

<html>
<head>
<style. type="text/css">
<!--
div{
 border:1px solid #000000;
 text-align:center;
 padding-top:expression(parseInt(this.style.height)/2-parseInt(this.childNodes(0).scrollHeight)/2);

}
//-->
</style>
</head>
<body>
请将 图片(可多张) 或 其它内容 插入&lt;span&gt;&lt;/span&gt;标签中<br>
<div style="width:200px;height:200px">
 <span>
  <img src="http://bbs.51js.com/images/common/xml.gif"><br>
  <img src="http://bbs.51js.com/images/common/xml.gif"><br>
  <img src="http://bbs.51js.com/images/common/xml.gif">
 </span>
</div>
<P>
<div style="width:200px;height:200px">
 <span>
  <img src="http://www.baidu.com/img/logo.gif"/>
 </span>
</div>
<P>
<div style="width:200px;height:200px">
 <span>
  asddsf
 </span>
</div>
<P>
</body>
</html>

   责任编辑:silvia    时间:2008年11月3日
  • 最近更新