• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

width of HTML table cell

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have a HTML table, the content of the cells are retrieved from database table. I specified the width of each cell (TD) in my HTML table, but when the cells are filled with content from database, the width of the HTML cells changed in my browser (IE6.0).
The following is an example of my table:
<table width="779">
<tr>
<td width="152">
<!--some code -->
</td>
<td width="621">
<table width="100%">
<tr width="100%">
<!--some code -->
</tr>
<tr width="100%">
<td width="100%">
<table width ="100">
<tr>
<td width="10"> col1</td>
<td width="100"> col2</td>
<td width="74"> col3</td>
<td width="100"> col4</td>
<td width="97">col5 </td>
<%if(condition){%> <td width="159">col6 </td> <%}%>
</tr>
<tr>
<td>value1</td>
<td>value2</td>
<td>value3</td>
<td>value4</td>
<td>value5 </td>
<%if(condition) {%> <td >value6 </td> <%}%>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
The value1 to value6 are retrieved from database. whether col6 and value6 will be displayed or not is conditional.
My problem is that the width of each cell changed based on the length of vaule1 to value6.
Can someone tell me how to make the length of each cell fixed?
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
assuming you want them the same width as the cells in the previous row, just set them like you did for it.


<table width="779">
<tr>
<td width="152">
<!--some code -->
</td>
<td width="621">
<table width="100%">
<tr width="100%">
<!--some code -->
</tr>
<tr width="100%">
<td width="100%">
<table width ="100">
<tr>
<td width="10"> col1</td>
<td width="100"> col2</td>
<td width="74"> col3</td>
<td width="100"> col4</td>
<td width="97">col5 </td>
<%if(condition){%> <td width="159">col6 </td> <%}%>
</tr>
<tr>
<td width="10">value1</td>
<td width="100">value2</td>
<td width="74">value3</td>
<td width="100">value4</td>
<td width="97">value5 </td>
<%if(condition) {%> <td width="159">value6 </td> <%}%>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

 
reply
    Bookmark Topic Watch Topic
  • New Topic