Sims said:
Barry Pearson wrote ...
Not true. In fact, if you want to layout semantically-related [snip]
Once again - are you talking about page-layout or the layout of
semantically-related data? For the latter - you are better off
sticking to tables. For the former - make up your own mind.
I am using tables for both data and page layout.
So I guess that technically my use of the tables is not wrong,(the
html is valid but used in the wrong way), but I need to re-write my
page-layout to use css.
Why? Will this make your websites more successful?
So to summarize, where I am going wrong is that I am using table for
page layout.
*as a general rules* tables should only be used to display data, not
the page.
No. If you want to layout semantically-related information in rows & columns,
use tables, and you will probably never regret it. Tables are super for laying
out information in rows & columns.
If you are talking about page-layout, then use tables, or CSS techniques, or
combinations of these, as appropriate. It is your choice, because you bear the
consequences. Perhaps 99% of pages on the web use table-layout, so you can be
certain that it works & that you are in good company. But there are
alternatives, that may suit you better. (I use one or the other or both, or
sometimes no special layout technique at all, as appropriate).
[snip]
I am guilty of using tables for page-layout so I guess I need to move
away from that ,(bad?), habit.
No. It's only mark-up, it isn't sin! For sematically-related rows & columns,
yoiu will almost certainly be better off if you use tables. For anything else,
make up your mind according to the consequences. It isn't a bad habit to use
tables for page-layout. It is simply an option, used by vast numbers of
successful professional web authors world-wide.
I will use an example of one of my typical page.
<table>
<tr><td colspan='3'>Menu</td></tr>
<tr>
<td width='25%'>Left menu</td>
<td width='50%'>Main body</td>
<td width='25%'>Right menu</td>
<td></td>
</tr>
</table>
That's the way I would do a page, but now I want to move away from
this and do it properly.
Who is to say that this isn't doing things properly? What problems has it
caused you? What audience have you lost? Has it cost you extra effort? What is
your method of judging whether it is proper or not? Have you simply been told,
by someone who isn't going to bear the consequences of what you do?
That is a plausible layout table (except for that 4th column which appears to
be redundant). But now start to use CSS as well, instead of "width".
Here are 3 pages that all use *exactly* the same layout table, not very
different from that one. They all use CSS instead of things like "width"
attributes (which is deprecated in td). Have a look at what can be done with a
combination of tables & CSS. (They are only for fun! I'm not really suggesting
that you do exactly this). The aim is to show some of the things that can be
done by combinations of tables & CSS positioning.
http://www.barry.pearson.name/articles/table_pages/exhibit04.htm
http://www.barry.pearson.name/articles/table_pages/exhibit05.htm
http://www.barry.pearson.name/articles/table_pages/exhibit07.htm
[snip]
But that also begs the question, if the code above is valid html, why
would css be better, (for page layout)?
The aim of a website is to communicate with the audience. Judge the techniques
you use according to that. Are you communicating? At acceptable cost, risk,
and time? Will you continue to do so in future? Tables & CSS are simply means
to that end.
The overwhelming majority of authors, including professional authors, use
layout tables. The overwhelming majority of pages on the web, including just
about all the most commercially-successful ones, use table-layout. Some of the
best brains at authoring use tableless-layouts. But are they more commercially
successful as a result? And what could those same brains output if they
decided to use table-layout instead?
I choose which technique to use, or which mixture, on a case by case basis.
But I think I take too many risks with my tableless-layouts, (they sometimes
blow apart in browser, & on systems, that I haven't been able to test on). And
if they were commercial pages I might play a bit safer, and use simple tables
instead.