• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 6. Tables > Which Elements Can Be Placed in a Table Cell?

Which Elements Can Be Placed in a Table Cell?

XHTML tables were developed with the intent of presenting columns of information, but that information does not necessarily have to be text based. You can place many types of page elements in a given table cell:

  • Text— Text is the most obvious thing to put in a table cell, but don't forget that you can format the text with physical and logical styles, heading styles, list formatting, line and paragraph breaks, and hypertext anchor formatting.

  • Images— You can place an image in a table cell by enclosing an <img/> element within the <td> element that defines the cell. This is useful for designing page layout with tables because you aren't constrained only to text.

  • Blank space— Sometimes it's useful to put a blank cell in a table. You can accomplish this by putting nothing between the cell's defining element (<td></td>) or by placing a nonbreaking space inside the element (<td>&nbsp;</td>). Use of the nonbreaking space is preferable because, if you have borders turned on, a cell with a nonbreaking space picks up a border, but a cell created with <td></td> might not.

  • Form fields— The ability to place form fields inside a table cell is very important, especially when you consider that the prompting text in front of form fields are of varying lengths. By putting prompting text and form fields in a table, you can align them all and make the form much more readable.

  • Other tables— You can embed one table inside another, although this can induce quite a headache for many people! Previously, only Netscape Navigator and Microsoft Internet Explorer supported tables within tables; but now that it is part of the XHTML 1.0 standard, other browsers should support it as they come into compliance with the new standard.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint