Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Workshop 285

10


Q&A


Q Tables are a real hassle to lay out, especially when you get into row and col-
umn spans. That last example was awful.

A 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.
Q Can you nest tables, putting a table inside a single table cell?


A Sure! As mentioned earlier, you can put any HTML code you want inside a table
cell, and that includes other tables. But nesting tables can significantly slow down
pages loading.
Q Is there a way to specify a beveled border like the default table borders using
CSS?


A CSS actually provides three different beveled border styles: inset, outset, and
ridge. You should experiment with them and use the one that looks the best to you.


Quiz



  1. What are the basic parts of a table, and which tags identify them?

  2. Which attribute is the most common attribute of the table tag, and what does it do?

  3. Which attributes are used to create cells that span more than one column or row?

  4. Which elements are used to define the head, body, and foot of a table?


Quiz Answers



  1. The basic parts of a table (the tag) are the caption (defined with the).

  2. 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. It is nonconforming in HTML5, but you will still see it on many tables
    to identify them as presentation or data tables.

  3. The rowspan attribute creates a cell that spans multiple rows. The colspan attribute
    creates a cell that spans multiple columns.


  4. , , and define the head, body, and foot of a table.

    tag), header cells (
    ), data cells (), and table rows (