I often work with tables and I found that I am confused on where I should be
placing the following elements:
width
height
valign
could I put all of them in the TD tag and leave the TABLE and TR tag blank?
It's time you learned to read a DTD
http://www.w3.org/TR/html4/sgml/dtd.html
or the version with notes
http://www.w3.org/TR/html4/struct/tables.html#edef-TABLE
The great thing about HTML (and pretty much all net protocols) is that
_you_ can read the real protocol definitions for yourself and for
free. Don't get it second-hand from some hack journalist's book, read
the genuine article.
Reading these, you'll find that only the <td> has width and height.,
and <tr> doesn't. <table> also has width, but that's the width of the
whole table, not a cell.
The align (horizontal) and valign attributes apply to both <tr> and
<td>, with scope applied much as you might expect.
There's also the <colgroup> and <col> elements, which are much
under-used. I've seen people nest tables to do things that were easily
and more simply done with <colgroup>, just through sheer ignorance of
their existence. Commonly you'll want to set alignment for a column
of <td>s (sometimes a width too) and using a <col> avoids the need to
repeat this on every <td>
As for CSS, then there is no reason why you _must_ do this. No reason
at all. It's not "better" to do this in any way - only if it gives you
some concrete advantage as a result can you talk about there being "a
benefit of CSS".
CSS is also a damn nuisance unless you understand it. Tag soup can be
a mess, but so is half-hearted CSS that's used by people who don't
know more than how to replace <font> with it.
The most obvious CSS benefit for tables is that it gives you more
dimension units to choose from. Rather than just pixel or percentage
units (or auto-size), you can also use ems or cm etc. In a world of
varying screen sizes, using ems instead of pixels can be a valuable
usability improvement.
If you have many table cells to worry about, using the class attribute
and some CSS can save you a lot of repeated width or alignment
settings. Otherwise you can use in-lined CSS with the style
attribute. Don't forget <col> either - it still works with CSS.