By armanschwarz on
Hi everyone, I'm sure this is simple for all you html/Css gurus out there so instead of torturing myself any longer I thought I might as well just ask. I'm trying to create a table with 2 columns, 1 row (ie. two sets of content next to each other), and want them both aligned to top, such that they start at the same point. The problem is that the table contents is a generated list of content, which varies in size for each of the columns. For some reason they always appear centered, so that the headings of each column are at different heights. Not very pretty.... Here is what I've done so far:
<table>
<tr VALIGN="TOP">
<td>
<h2 class="title">Visit the Forums</h2>
<?php
$block = module_invoke('featured_content', 'block', 'view', 3);
print $block['content'];
?>
</td>
<td>
<h2 class="title">Global Warming Articles</h2><?php
$block = module_invoke('featured_content', 'block', 'view', 2);
print $block['content'];
?>
</td>
</tr>
</table>
the valign tag doesn't really seem to do anything... Any ideas?
Comments
So, the valign tag is
So, the valign tag is supposed to go on the td, not the tr. Try it again that way.
http://www.w3schools.com/tags/att_td_valign.asp
Right... So I got off to a
Right... So I got off to a bad start with my html attempt. Anyway, your solution fixed the problem for a simple table without the php script. However, I then tried this code (same as before with your suggestion):
and I ended up with the same problem (ie. the content just in the middle of the cell). Here is the page source for that section, in case this might help:
Could this have something to do with the featured content blocks/module? If so, is there a workaround?
Do it in your stylesheets
Great, thanks for the help. I
Great, thanks for the help. I added the following to my stylesheet:
And then tagged the table with class="table-class" and it worked. Can you explain why this worked but adding the VALIGN to the td's didn't? Would be good to know in future..
VALIGN is deprecated in most
VALIGN is deprecated in most DOCTYPES and unsupported in XHTML 1.0 Strict.
Contributed modules like
Contributed modules like Panels and WYSIWYG are helpful tools in escaping the torture chamber when struggling with layout issues.
http://drupal.org/project/panels
http://drupal.org/project/wysiwyg