Foundation HTML5 with CSS3

(Steven Felgate) #1
Building Tables

Styling Captions

The caption element, as you saw earlier, will typically appear above its parent table element. Its position
is determined by the caption-side property. Using the markup in Listing 7-25 and the CSS in Listing 7-
26, you’ll see the ease with which you can style a table’s caption.
Listing 7-25. A table with an added caption element

<table>
<caption>
<h2>Power Outfitters Inventory</h2>
<p>Power Outfitters continues to stock only the finest products 
for all your crime-solving needs.</p>
</caption>
<colgroup>
<col id="products-column">
<col id="quantity-column">
<col id="price-column">
<col id="totals-column">
</colgroup>
<thead>
<tr>
<th scope="col">Product</th>
<th scope="col">Quantity</th>
<th scope="col">Price</th>
<th scope="col">Totals</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Utility Belts</th>
<td>9</td>
<td>$129.99</td>
<td>$1,169.91</td>
</tr>
<tr>
<th scope="row">Grappling Hooks</th>
<td>27</td>
<td>$79.99</td>
<td>$2,159.73</td>
</tr>
<tr>
<th scope="row">Smoke Pellets</th>
<td>623</td>
<td>$4.99</td>
<td>$3,108.77</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">Totals</th>
<td>659</td>
Free download pdf