Today's lesson covered one of the more complex subjects in HTMLtables. Before you move on to full immersion into the world of Cascading Style Sheets, you should work through the following questions and exercises to make sure that you've really got a good grasp of how tables work.
Tables are a real hassle to lay out, especially when you get into row and column spans. That last example was awful.
You're right. Tables are a tremendous pain to lay out by hand like this. However, if you're using writing editors and tools to generate HTML code, having the table defined like this makes more sense because you can just write out each row in turn programmatically.
Can you nest tables, putting a table inside a single table cell?
Sure! As I mentioned earlier, you can put any HTML code you want inside a table cell, and that includes other tables.
Why does most of the world use align for positioning a caption at the top or bottom of a page, but Internet Explorer does something totally different?
I don't know. And worse, Microsoft claims it got that definition for Internet Explorer from HTML 3.0, but no version of HTML 3.0 or the tables specification in HTML 3.2 has it defined in that way. HTML 4.01 added left and right aligning to this attribute, but Internet Explorer added that alignment before HTML even mentioned the possibility.
What are the basic parts of a table, and which tags identify them?
Which attribute is the most common attribute of the table tag, and what does it do?
What attributes define the amount of space between the edges of the cells and their content, and the amount of space between cells?
Which attributes are used to create cells that span more than one column or row?
Which elements are used to define the head, body, and foot of a table?
The basic parts of a table (the <table> tag) are the border (defined with the border attribute), the caption (defined with the <caption> tag), header cells (<th>), data cells (<td>), and table rows (<tr>).
The border attribute is the most common attribute for the table tag. It specifies whether border lines are displayed around the table, and how wide the borders should be.
cellpadding defines the amount of space between the edges of the cell and their contents. cellspacing defines the amount of space between the cells.
The rowspan attribute creates a cell that spans multiple rows. The colspan attribute creates a cell that spans multiple columns.
<thead>, <tbody>, and <tfoot> define the head, body, and foot of a table.
Here's a brainteaser for you: Create a simple nested table (a table within a table) that contains three rows and four columns. Inside the cell that appears at the second column in the second row, create a second table that contains two rows and two columns.
Modify the table shown in Figure 8.30 so that the rules in the table only appear between columns.