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

(singke) #1
ptg16476052

246 LESSON 10: Building Tables


<td>Blue</td>
<td>Blue</td>
<td>Brown</td>
</tr>

Figure 10.2 shows how this table is displayed in a browser.

Output ▼


Empty Cells
Both table heading cells and data cells can contain any text, HTML code, or both, includ-
ing links, lists, forms, images, and other tables. But what if you want a cell with nothing
in it? That’s easy. Just define a cell with a <th> or <td> element with nothing inside it:

Input ▼
<table border="1">
<tr>
<td></td>
<td> 10 </td>
<td> 20 </td>
</tr>
</table>

Some older browsers display empty cells of this sort as if they don’t exist at all, leaving
off the borders. If you want to force a truly empty cell, you can add a line break with no
other text in that cell by itself:

Input ▼
<table border="1">
<tr>
<td><br></td>

FIGURE 10.2
An example of a
table that includes
headings in the
leftmost column.
Free download pdf