Help - Search - Members - Calendar
Full Version: Tables and spacing
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
JGar
Hi,

I have code which inserts a table within a table. The inner table has some blank space above and below it in the cell, which I want to get rid of. Please look at the attached picture. The grid like table with 6 pictures is inserted in the bigger table. It has empty space above and below the table, which I don't want. Please advise how to change the code to remove this space.

The code looks like this:

<table id="product-info-table" border="1" bordercolor="#5A1200" height="400" width="600" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="2">
<?php print theme('imagecache', 'collection_view', $node->field_collection_image[0]['filename'], '', ''); ?>
</td>
</tr>
<tr>
<td>
<table height="200" width="300" border="1" bordercolor="#5A1200" cellspacing="0" cellpadding="0" style="background:#ffffff">
<?php
$products = array();
foreach($node->taxonomy as $termObj) {
$nodes = taxonomy_select_nodes(array('5'), 'or', 0, FALSE, 'n.sticky DESC, n.created DESC');
$count = 0;
while (($data = db_fetch_array($nodes)) && ($count < 6)) {
$n = node_load($data['nid']);
if ($n->type == 'product_info') {
$count = $count + 1;
$products[$count] = $n;
}
}
}
if ($count == '6') {
print '<tr>';
print '<td>';
print theme('imagecache', 'product_teaser', $products[1]->field_picture[0]['filename'], '', '');
print '</td>';
print '<td>';
print theme('imagecache', 'product_teaser', $products[2]->field_picture[0]['filename'], '', '');
print '</td>';
print '<td>';
print theme('imagecache', 'product_teaser', $products[3]->field_picture[0]['filename'], '', '');
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print theme('imagecache', 'product_teaser', $products[4]->field_picture[0]['filename'], '', '');
print '</td>';
print '<td>';
print theme('imagecache', 'product_teaser', $products[5]->field_picture[0]['filename'], '', '');
print '</td>';
print '<td>';
print theme('imagecache', 'product_teaser', $products[6]->field_picture[0]['filename'], '', '');
print '</td>';
print '</tr>';
} ?>
</table>
</td>
<td>
<div margin="5" height="200" width="300" style="background:#BCBEC0;">
<?php print $node->field_description[0]['view']; ?>
</div>
</td>
</tr>
</tbody>
</table>
pandy
Please post the URL to the page or at least copy the rendered markup (View Source) and past it in here. We can't parse PHP in our heads. wink.gif
JGar
I have nto been able to attach the picture. Here is the rendered HTML:

<div class="content">
<table id="product-info-table" border="1" bordercolor="#5A1200" height="400" width="600" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="2">
<img src="http://localhost/drupal/sites/default/files/imagecache/collection_view/safari.jpg" alt="" title="" class="imagecache imagecache-collection_view" width="600" height="200" />
</td>
</tr>
<tr>
<td>
<table height="200" width="300" border="1" bordercolor="#5A1200" cellspacing="0" cellpadding="0" style="background:#ffffff">
<tr><td><img src="http://localhost/drupal/sites/default/files/imagecache/product_teaser/toastWordRack.jpg" alt="" title="" class="imagecache imagecache-product_teaser" width="100" height="100" /></td><td><img src="http://localhost/drupal/sites/default/files/imagecache/product_teaser/toastRack.jpg" alt="" title="" class="imagecache imagecache-product_teaser" width="100" height="100" /></td><td><img src="http://localhost/drupal/sites/default/files/imagecache/product_teaser/seaShell4.jpg" alt="" title="" class="imagecache imagecache-product_teaser" width="100" height="100" /></td></tr><tr><td><img src="http://localhost/drupal/sites/default/files/imagecache/product_teaser/seaShell3.jpg" alt="" title="" class="imagecache imagecache-product_teaser" width="100" height="100" /></td><td><img src="http://localhost/drupal/sites/default/files/imagecache/product_teaser/seaShell2.jpg" alt="" title="" class="imagecache imagecache-product_teaser" width="100" height="100" /></td><td><img src="http://localhost/drupal/sites/default/files/imagecache/product_teaser/seaSehell1.jpg" alt="" title="" class="imagecache imagecache-product_teaser" width="100" height="100" /></td></tr> </table>
</td>
<td>
<div margin="5" height="200" width="300" style="background:#BCBEC0;">
This collection is a tribute to the vast African landscape. Itís flora and fauna, itís ways which we will cherish forever. </div>
</td>
</tr>
</tbody>
</table>
</div>

pandy
I'm not sure I see a gap, but there are lots of errors. The inner table lacks all closing tags. I see no reason for that colspan="2". DIV can't use the attributes width, height and margin.

Use the validator and get it right first. If the gap is still there, post again and we'll have a new look.
http://htmlhelp.com/tools/validator/
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.