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

(singke) #1
ptg16476052

250 LESSON 10: Building Tables


Continue by adding the remaining two rows in the table, with the Yellow and Blue head-
ings. Here’s what you have so far for the entire table:

Input ▼
<table border="1">
<tr>
<th>Red</th>
<th>Yellow</th>
<th>Blue</th>
</tr>
<tr>
<th>Red</th>
<td>Red</td>
<td>Orange</td>
<td>Purple</td>
</tr>
<tr>
<th>Yellow</th>
<td>Orange</td>
<td>Yellow</td>
<td>Green</td>
</tr>
<tr>
<th>Blue</th>
<td>Purple</td>
<td>Green</td>
<td>Blue</td>
</tr>
</table>

Finally, add a simple caption. The <caption> element goes just after the <table> tag and
just before the first <tr> tag:
<table border="1">
<caption>Mixing the Primary Colors</caption>
<tr>

With a first draft of the code in place, test the HTML file in your favorite browser that
supports tables. Figure 10.5 shows how it looks.


Free download pdf