简体   繁体   English

动态生成的表格项的单元格边距

[英]cell margin for dynamically generated table items

There is a huge margin between Odo and Location columns even though I have set the width for the td tag. 即使我已经为td标签设置了宽度,在OdoLocation列之间仍然有很大的余量。

I have a simple table: 我有一个简单的表:

<table width="95%" border="0" cellspacing="0" cellpadding="2">
       <tr>
        <td width="18%" style="padding-left: 15px">Date</td>
        <td width="16%">Type</td>
        <td width="16%">Odo</td>
        <td width="20%">Location</td>
        <td width="46%">Remark</td>
      </tr>
      {ITEMSLIST}
</table>

My above items list is coming dynamically like this: 我的上述物品清单是这样动态变化的:

itemList += "<tr><td align='left' style='font-size:8px; color:#03F;padding-left: 15px'>"
                                +displayFormat.format(idate)+ "</td><td style='font-size:8px; color:#03F'>"
+ cur2.getString(0)+ " Practicle</td><td style='font-size:8px; color:#03F'>"
+ "200"+ "</td><td style='font-size:8px; color:#03F'>"
+ location+ "</td><td style='font-size:8px; color:#03F'>"
+ cur2.getString(3) + "</td></tr>";

I explicitly needed to define the width for all dynamically generated td tags and it went just fine- 我明确地需要为所有动态生成的td标签定义宽度,而且宽度还不错,

itemList += "<tr><td align='left'  width='18%' style='font-size:8px; color:#03F;padding-left: 15px; '>"+displayFormat.format(idate)
    + "</td><td width='16%' style='font-size:8px; color:#03F'>"
    + cur2.getString(0)+ " Practicle</td><td width='16%' style='font-size:8px; color:#03F'>"
    + "200"+ "</td><td width='20%' style='font-size:8px; color:#03F'>"
    + location
    + "</td><td width='46%' style='font-size:8px; color:#03F'>"
    + cur2.getString(3) + "</td></tr>";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM