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.

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

Answers


I explicitly needed to define the width for all dynamically generated td tags and it went just fine-

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

Need Your Help

Creating a new Blog with Octopress

octopress

I am reading this tutorial to create a new blog using the octopress

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.