Long-time designers may be well-versed in the practice of using height and width attributes
to control table and cell dimensions, but beware. The width attribute is fine to use on
table start tags (the possible values of which are a number denoting the width in pixels of
the table, and a percentage, which is a percentage of the parent element??™s size). However,
the height attribute is nonstandard and fails in the majority of web browsers (in fact, if
using an XHTML DTD, it fails in every currently shipping mainstream browser), which might
come as something of a shock to those people who enjoy centering content in a browser
window by using a table.
In the preceding HTML, the cell elements are indented to make it easier for you to
make them out. This wasn??™t done earlier in the chapter. Either method of writing
markup is fine??”it??™s up to you. Note, however, that if you use images within table cells,
this extra whitespace in the HTML sometimes causes layouts to break, and must therefore
be deleted.
TABLES: HOW NATURE (AND THE W3C) INTENDED
237
6
As for setting widths and heights within table cells, that??™s something that should be
avoided altogether??”height and width attributes within table cells are deprecated. You
might argue that this is irrelevant??”after all, all major browsers support these attributes.
Although this is true, deprecated attributes are not guaranteed to be supported in the
future. Also, table cells always expand to accommodate the widest or tallest element in a
row or column.
Pages:
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332