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

时间:2013-04-17 12:40:42

标签: java html margin padding

OdoLocation列之间存在巨大的差距,即使我设置了。{ td代码的宽度。

我有一张简单的表格:

<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>

我的上述项目列表动态如下:

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>";

1 个答案:

答案 0 :(得分:0)

我明确需要为所有动态生成的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>";