semantic markup - Nested tables with related parent content -
semantic markup - Nested tables with related parent content -
having semantics issue. have basic table standard header , footer. each row contains order, beneath each row need display table, contain break downwards of costs relating order. additionally, these inner tables displayed jquery accordion hide , show when required (but i'm concentrating on html now)
how can semantically approach in html?
<table> <thead> <th>package number</th> <th>date placed</th> <th>placed by</th> <th>total cost</th> </thead> <tr> <td>1</td> <td>weds</td> <td>jonno</td> <td>£15</td> </tr> <tr> <td colspan="4"> <table> <thead> <th>part number</th> <th>description</th> <th>qty shipped</th> <th>weight</th> </thead> <tbody> <td>18293</td> <td>blah blah blah</td> <td>72</td> <td>20kg</td> </tbody> </table> </td> </tr> <tr> <td>2</td> <td>thurs</td> <td>jonno</td> <td>£1</td> </tr> <tr> <td>3</td> <td>fri</td> <td>jonno</td> <td>£7</td> </tr> </table>
here's fiddle: http://jsfiddle.net/yuw7f/ - problem here row containing inner table, totally unrelated order row
if looking parent element can utilize grouping related rows, can utilize <tbody>
elements. table can have multiple <tbody>
elements:
<table> <thead> <tr> <th>package number</th> <th>date placed</th> <th>placed by</th> <th>total cost</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>weds</td> <td>jonno</td> <td>£15</td> </tr> <tr> <td colspan="4"> <table> <thead> <tr> <th>part number</th> <th>description</th> <th>qty shipped</th> <th>weight</th> </tr> </thead> <tbody> <tr> <td>18293</td> <td>blah blah blah</td> <td>72</td> <td>20kg</td> </tr> </tbody> </table> </td> </tr> </tbody> <tr> <td>2</td> <td>thurs</td> <td>jonno</td> <td>£1</td> </tr> <tr> <td>3</td> <td>fri</td> <td>jonno</td> <td>£7</td> </tr> </table>
whether or not makes code more semantically right debatable. give rows classes indicate whether row summary row or detail row, or attributes indicate relationships other rows. semantically, seems fine me.
by way, missing <tr>
elements. <tbody>
, <thead>
, or <tfoot>
element not replace <tr>
element.
html-table semantic-markup
Comments
Post a Comment