日期:2014-05-16  浏览次数:20414 次

table 嵌套问题

我有个table里面有table的嵌套 。嵌套的深度也是随机的。 
现在的问题是:边框会重叠起来。我想实现重叠的边框是1像素的。。
有那位高手能解决吗?

------解决方案--------------------
为什么一定要用table?

http://stackoverflow.com/questions/83073/why-not-use-tables-for-layout-in-html

用table,坏处多多,而且你还要嵌套循环使用。OMG~~
------解决方案--------------------
用table这种情况是一定会出现的啦、不如考虑用别的东西、比如盒子模型。
------解决方案--------------------
可以设置除了第一个table之外的要插入的table的border=0.
------解决方案--------------------
你在生成table 的时候

应该是先生成:父外层table在生成下层table

现在你需要做的就是:在生成父table的时,判断有没有下级的table如果有则边框不能有,如果没有则产生边框

------解决方案--------------------
网上搜的

HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
td{ border-right:solid 1px #000; border-top:solid 1px #000}
</style>
</head>

<body>
<div>
     <table width="200" border="0" cellpadding="0" cellspacing="0" style="border-left:solid 1px #000; border-bottom:solid 1px #000">
  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td>aa</td>
  <td colspan="3" >
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td height="26" style="border-top: none;">&nbsp;</td> 
  <td style="border-top: none;">&nbsp;</td>
  <td style="border-top: none;">&nbsp;</td>
  <td style="border-top: none;">&nbsp;</td>
  <td style="border-top: none; border-right: none;">&nbsp;</td>
  </tr>
  <tr>
  <td>&nbsp;</td> 
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td style="border-right: none;">&nbsp;</td>
  </tr>
  </table>
  </td>
  </tr>
  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
</table>
</div>
</body>
</html>

------解决方案--------------------
悄悄的跟楼主讲,你的这个需求其实用ado.net在excel中实现,最方便