The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Tables and spacing, spacing when embedding a table within a table
JGar
post Dec 22 2009, 08:33 AM
Post #1





Group: Members
Posts: 3
Joined: 22-October 09
Member No.: 10,106



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>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 22 2009, 09:07 AM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,197
Joined: 9-August 06
Member No.: 6



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


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
JGar
post Dec 22 2009, 09:33 AM
Post #3





Group: Members
Posts: 3
Joined: 22-October 09
Member No.: 10,106



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>

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 22 2009, 07:25 PM
Post #4


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,197
Joined: 9-August 06
Member No.: 6



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/


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th July 2014 - 05:05 PM