IN THIS CHAPTER
Parts of an HTML table
Table width and alignment
Cell spacing and padding
Borders and rules
Row groups — header, body, and footer
Spanning columns and rows
Tables are a powerful HTML tool with many uses. Developed originally to help communicate tabular data (usually scientific or academic-based data), tables are now used for many purposes — from simply holding tabular data to the layout of entire pages. This chapter covers the basics of tables and progresses into more complex uses of this versatile structure of HTML.
With the advent of CSS, there are many that proclaim tables should no longer be used for layout purposes. Instead, CSS should be used to style and position elements for the sake of layout. However, this is not necessarily the case. Despite the existence of CSS, HTML tables still make a perfectly acceptable layout mechanism, whether on a micro level — a simple table of headers and values — or on a macro level — the layout basis for an entire page or document.
Arguments can be made for both technologies and the debate can get very heated (try searching for "HTML table layout versus CSS layout" at
www.google.com). My advice is to use whichever technology makes sense to you, what you are most comfortable with, what presents your documents in the best light, or what appears to be the best tool for the job.
An HTML table is made up of the following parts: