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

如果让td里面的textbox刚好占满td的剩余空间(td中还有其他控件)
HTML code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>

  <TABLE style="table-layout:fixed" border=1>
  <TR>
    <TD><nobr>aaaaaa abcd<input type=text style="margin-left:0;margin-right:0"></TD>
  </TR>
  </TABLE>

 </BODY>
</HTML>



如果让td里面的textbox刚好占满td的剩余空间(td中还有其他控件)?

------解决方案--------------------

不是TD的原因,是input 有默认的1像素间距
------解决方案--------------------
HTML code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<TABLE class="tbl" style="border:1px solid #CCC">
  <TR>
    <TD nowrap>aaaaaa abcd</TD>
    <TD width="100%"><input type=text style="margin-left:0;margin-right:0; width:100%"></TD>
  </TR>
</TABLE>
</BODY>
</HTML>

------解决方案--------------------
class没用到,去掉吧。
------解决方案--------------------
分成两个td了,你没copy代码下来试试吗?
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>

<TABLE style="table-layout:fixed" border=1>
<TR>
<TD>aaaaaa abcd<input type=text style="margin-left:0;margin-right:0; width:80%;"></TD>
</TR>
</TABLE>

 </BODY>
</HTML>
根据控件大小来设置<INPUT TYPE="TEXT"/>的宽度
------解决方案--------------------
rregdfffffffffffff