H43: Using id and headers attributes to associate data cells with header cells in data tables

HTML Snippet Code
Scenario 1: Table data cells has improper association with two headers
Imported and domestic orange and apple prices in Sydney and Melbourne
Imported Domestic
Oranges Apples Oranges Apples
Sydney
Wholesale $1.00 $1.25 $1.20 $1.00
Retail $2.00 $3.25 $1.80 $1.60
Melbourne
Wholesale $1.00 $1.25 $1.20 $1.00
Retail $2.00 $3.25 $1.80 $1.60
<table summary="Wholesale and retail prices of imported and domestic oranges and apples in Sydney and Melbourne. There are two levels of column headings." border="1"> <caption style="color:blue;"> Imported and domestic orange and apple prices in Sydney and Melbourne </caption> <thead> <tr> <td></td> <th colspan="2" id="imported">Imported</th> <th colspan="2" id="domestic">Domestic</th> </tr> <tr> <td></td> <th id="oranges-imp">Oranges</th> <th id="apples-imp">Apples</th> <th id="oranges-dom">Oranges</th> <th id="apples-dom">Apples</th> </tr> </thead> <tbody> <tr> <th id="sydney" colspan="5">Sydney</th> </tr> <tr> <th headers="sydney" id="wholesale-sydney">Wholesale</th> <td headers="imported apples-imp sydney wholesale-sydney">$1.00</td> <td headers="imported oranges-imp sydney wholesale-sydney">$1.25</td> <td headers="domestic oranges-dom sydney wholesale-sydney">$1.20</td> <td headers="domestic apples-dom sydney wholesale-sydney">$1.00</td> </tr> <tr> <th headers="sydney" id="retail-sydney">Retail</th> <td headers="imported apples-imp sydney wholesale-sydney"> $2.00</td> <td headers="imported oranges-imp sydney wholesale-sydney"> $3.25</td> <td headers="domestic oranges-dom sydney wholesale-sydney"> $1.80</td> <td headers="domestic apples-dom sydney wholesale-sydney"> $1.60</td></tr> <tr> <th id="melbourne" colspan="5">Melbourne</th> </tr> <tr> <th headers="melbourne" id="wholesale-melbourne">Wholesale</th> <td headers="imported apples-imp melbourne wholesale-melbourne">$1.00</td> <td headers="imported oranges-imp melbourne wholesale-melbourne">$1.25</td> <td headers="domestic oranges-dom melbourne wholesale-melbourne">$1.20</td> <td headers="domestic apples-dom melbourne wholesale-melbourne">$1.00</td> </tr> <tr> <th headers="melbourne" id="retail-melbourne">Retail</th> <td headers="imported apples-imp melbourne retail-melbourne"> $2.00</td> <td headers="imported oranges-imp melbourne retail-melbourne"> $3.25</td> <td headers="domestic oranges-dom melbourne retail-melbourne"> $1.80</td> <td headers="domestic apples-dom melbourne retail-melbourne"> $1.60</td></tr> </tbody> </table>
Scenario 2: Table data cells do not have header association
Imported and domestic orange and apple prices in Sydney and Melbourne
Imported Domestic
Oranges Apples Oranges Apples
Sydney
Wholesale $1.00 $1.25 $1.20 $1.00
Retail $2.00 $3.25 $1.80 $1.60
Melbourne
Wholesale $1.00 $1.25 $1.20 $1.00
Retail $2.00 $3.25 $1.80 $1.60
<table summary="Wholesale and retail prices of imported and domestic oranges and apples in Sydney and Melbourne. There are two levels of column headings." border="1"> <caption style="color:blue;"> Imported and domestic orange and apple prices in Sydney and Melbourne </caption> <thead> <tr> <td></td> <td colspan="2">Imported</td> <td colspan="2">Domestic</td> </tr> <tr> <td></td> <td>Oranges</td> <td>Apples</td> <td>Oranges</td> <td>Apples</td> </tr> </thead> <tbody> <tr> <td colspan="5">Sydney</td> </tr> <tr> <td>Wholesale</td> <td>$1.00</td> <td>$1.25</td> <td>$1.20</td> <td>$1.00</td> </tr> <tr> <td>Retail</td> <td> $2.00</td> <td> $3.25</td> <td> $1.80</td> <td> $1.60</td></tr> <tr> <td>Melbourne</td> </tr> <tr> <td>Wholesale</td> <td>$1.00</td> <td>$1.25</td> <td>$1.20</td> <td>$1.00</td> </tr> <tr> <td>Retail</td> <td> $2.00</td> <td> $3.25</td> <td> $1.80</td> <td> $1.60</td></tr> </tbody> </table>