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

表格宽度问题,请高手帮忙
<table border="0" cellspacing="0" cellpadding="0">
  <thead>
  <tr>
  <td width="20">&nbsp;</td>
  <td width="60">&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td colspan="4" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="display:none;" id="t1">
  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <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>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
</table>
</td>
  </tr>
  </tbody>
  </table>


当id="t1"的表格显示的列数大于外部table列数时,外部table宽度等于20的td的宽度会变宽,请问如何解决!
急急急!

------解决方案--------------------
table的宽度和高度会随着里面的子容器撑开,overlfow:hidden;都不管用,如果想要在td里面限制宽度,在里面加一个div,在套table

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>

 <body bgcolor="yellow">
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td width="20">&nbsp;</td>
<td width="60">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</thead>
<tbody>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="4" valign="top"&g