SlideShare a Scribd company logo
8
TABLE MARKUP
OVERVIEW
• How tables are structured
• Table headers
• Cell spanning (rows and columns)
• Table captions
• Row and column groups
Tabular Data
HTML table markup is for data arranged into rows and columns.
HTML Table Structure
Tables are made up of cells arranged into rows.
A simple table
HTML Table Structure (cont’d.)
How it looks using markup (table, tr, th, and td):
NOTE: Columns are implied by the number of cells in each row (not
created with column elements).
HTML Table Structure (cont'd)
The same table written in code:
<table>
<tr>
<th>Menu item</th>
<th>Calories</th>
<th>Fat (g)</th>
</tr>
<tr>
<td>Chicken noodle soup</td>
<td>120</td>
<td>2</td>
</tr>
<tr>
<td>Caesar salad</td>
<td>400</td>
<td>26</td>
</tr>
</table>
Default browser display:
The table Element
<table> </table>
• Identifies tabular material
• Contains some number of row (tr) elements
• Optionally, may also have a caption element and row and
column group elements
Table Row (tr) Element
<tr> </tr>
• tr stands for “table row.”
• The only thing that can go between tr tags is some number
of th (header) and td (data cell) elements.
• There may be no text content in a row that is not contained
within a header or data cell.
Table Cells
<td> </td>
• td stands for “table data.”
• Cells can contain any type of web content.
• All content in a table must be contained in td tags.
Table Headers
<th> </th>
• th stands for “table header.”
• Headers provide information about the cells in the row or
column they precede.
• They are key tools for making table content accessible.
Screen readers may read headers aloud before each data
cell, providing context that is missing when you can’t see the
table.
• Headers are often rendered in a bold font by default.
Table Columns Are Implied
<table>
<tr>
<th>Burgers</th>
<td>Organic Grass-fed Beef</td>
<td>Black Bean Veggie</td>
</tr>
<tr>
<th>Fries</th>
<td>Hand-cut Idaho potato</td>
<td>Seasoned sweet potato</td>
</tr>
</table>
This table would have 2 rows and 3 columns
(because there are 3 cells defined in each row):
Spanning Cells
Spanning
Stretching a cell to cover several rows or columns
Column span
Stretching a cell to the right over subsequent columns
Row span
Stretching a cell downward over several rows
Column Spans
<table>
<tr>
<th colspan="2">Fat</th>
</tr>
<tr>
<td>Saturated Fat (g)</td>
<td>Unsaturated Fat (g)</td>
</tr>
</table>
Notice that the first tr element only has one cell in it now. Every row
should have the same number of cells or equivalent colspan values.
Use the colspan attribute to specify the number of columns the cell
should span over:
Row Spans
<table>
<tr>
<th rowspan="3">Serving Size</th>
<td>Small (8oz.)</td>
</tr>
<tr>
<td>Medium (16oz.)</td>
</tr>
<tr>
<td>Large (24oz.)</td>
</tr>
</table>
The rowspan attribute to specifies the number of rows the cell
spans:
Notice that the td elements that were spanned over are no longer in
the source.
Table Caption
<caption> </caption>
• Provides a title or description for the table
• Improves table accessibility
• The caption element must appear first in the table element.
• The caption displays above the table by default.
Table Caption (cont’d)
<table>
<caption>Nutritional Information</caption>
<tr>
<th>Menu item</th>
<th>Calories</th>
<th>Fat (g)</th>
</tr>
…table continues…
</table>
Row and Column Groups
• For complicated tables, you can create semantic groups of
rows and/or columns that describe the table’s structure.
• Row group and column group elements also provide more
“hooks” for scripting and styling.
Row Groups
<thead> </thead>
<tbody> </tbody>
<tfoot> </tfoot>
• Provide additional semantic structure
• Row group elements may contain one or more tr elements
(no direct text content).
• Some browsing agents may repeat the header and footer
rows on tables that span multiple pages.
Row Groups (cont’d)
<table>
…
<thead>
<!-- headers -->
<tr></tr>
<tr></tr>
<tr></tr>
<thead>
<tbody>
<!-- data -->
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
</tbody>
<tfoot>
<!-- footnote -->
<tr></tr>
</tfoot>
</table>
NOTE: this table also utilizes
row and column spans.
Column Groups
<colgroup> </colgroup>
<col> </col>
• Allows you to assign id and class names to columns so
they can be accessed by scripts or styles
• colgroup elements go at the start of the table, after the
caption element if there is one.
• colgroup elements contain no content; they only provide an
indication of column structure
Column Groups (cont’d)
If you need to access
individual columns, identify
them with col elements:
<table>
<caption>…</caption>
<colgroup></colgroup>
<colgroup span="2"></colgroup>
<colgroup span="2"></colgroup>
<!-- rest of table... -->
The number of columns in a
group is noted with the span
attribute:
<colgroup></colgroup>
<colgroup>
<col class="start">
<col class="end">
</colgroup>
<colgroup>
<col class="start">
<col class="end">
</colgroup>

More Related Content

PPTX
Chapter 8: Tables
PPTX
HTML Tables
PPTX
Table structure introduction
PPT
HTML Tables.ppt
PPTX
HTML-Tables-A-Comprehensive-Guide (1).pptx
PPTX
Method of creating table using HTML.pptx
PPTX
WEP4 and 5.pptx
PDF
Chapterrrrrrrrrrr_10_Building Tables.pdf
Chapter 8: Tables
HTML Tables
Table structure introduction
HTML Tables.ppt
HTML-Tables-A-Comprehensive-Guide (1).pptx
Method of creating table using HTML.pptx
WEP4 and 5.pptx
Chapterrrrrrrrrrr_10_Building Tables.pdf

Similar to ClasServer-Side Development 2: Node.jss08 .pdf (20)

PPTX
Web topic 12 tables in html
PDF
Web I - 03 - Tables
PPTX
PPTX
htmltables-180721142906-1.pptx
PPSX
Computer language - Html tables
PPTX
Html tables
PPT
Lecture 2.ppt
PDF
Html tables
PPTX
Lecture-4.pptx
PPTX
Html table
PPTX
HTML Tables in Omeka
PPTX
Table in MS Frontpage 2003
PPTX
A PPT on Creation of Tables in HTML, WEB Designing
PPT
Response Tables.ppt
PPT
chapter 3 Basics of web design chapter 3 forcusing html tables
PDF
HTML Lecture Part 2 of 2
PPTX
Web design - Working with tables in HTML
DOCX
table html web programing
PPTX
Html web designing using tables
PPTX
Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)
Web topic 12 tables in html
Web I - 03 - Tables
htmltables-180721142906-1.pptx
Computer language - Html tables
Html tables
Lecture 2.ppt
Html tables
Lecture-4.pptx
Html table
HTML Tables in Omeka
Table in MS Frontpage 2003
A PPT on Creation of Tables in HTML, WEB Designing
Response Tables.ppt
chapter 3 Basics of web design chapter 3 forcusing html tables
HTML Lecture Part 2 of 2
Web design - Working with tables in HTML
table html web programing
Html web designing using tables
Std 10 Computer Chapter 4 List and Table Handling in HTML (Part 2 Table in HTML)
Ad

Recently uploaded (20)

PDF
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
PPTX
Safety_Pharmacology_Tier2_Edibbbbbbbbbbbbbbbable.pptx
PPTX
the-solar-system.pptxxxxxxxxxxxxxxxxxxxx
PDF
My Oxford Year- A Love Story Set in the Halls of Oxford
PPTX
Other Dance Forms - G10 MAPEH Reporting.pptx
DOC
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
PPTX
Understanding Colour Prediction Games – Explained Simply
PDF
Apresentação2 analise estrutual.hhjghjpdf
PPTX
just letters randomized coz i need to up
PPT
business model and some other things that
PDF
Download FL Studio Crack Latest version 2025
PDF
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
PDF
Commercial arboriculture Commercial Tree consultant Essex, Kent, Thaxted.pdf
PDF
Ct.pdffffffffffffffffffffffffffffffffffff
PDF
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
PDF
Gess1025.pdfdadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PPTX
PRECISION AGRICULTURE- 1.pptx for agriculture
DOCX
Elisabeth de Pot, the Witch of Flanders .
PDF
Songlyrics.net-website for lyrics song download
PPTX
What Makes an Entertainment App Addictive?
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
Safety_Pharmacology_Tier2_Edibbbbbbbbbbbbbbbable.pptx
the-solar-system.pptxxxxxxxxxxxxxxxxxxxx
My Oxford Year- A Love Story Set in the Halls of Oxford
Other Dance Forms - G10 MAPEH Reporting.pptx
NSCAD毕业证学历认证,温哥华岛大学毕业证国外证书制作申请
Understanding Colour Prediction Games – Explained Simply
Apresentação2 analise estrutual.hhjghjpdf
just letters randomized coz i need to up
business model and some other things that
Download FL Studio Crack Latest version 2025
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
Commercial arboriculture Commercial Tree consultant Essex, Kent, Thaxted.pdf
Ct.pdffffffffffffffffffffffffffffffffffff
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
Gess1025.pdfdadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PRECISION AGRICULTURE- 1.pptx for agriculture
Elisabeth de Pot, the Witch of Flanders .
Songlyrics.net-website for lyrics song download
What Makes an Entertainment App Addictive?
Ad

ClasServer-Side Development 2: Node.jss08 .pdf

  • 2. OVERVIEW • How tables are structured • Table headers • Cell spanning (rows and columns) • Table captions • Row and column groups
  • 3. Tabular Data HTML table markup is for data arranged into rows and columns.
  • 4. HTML Table Structure Tables are made up of cells arranged into rows. A simple table
  • 5. HTML Table Structure (cont’d.) How it looks using markup (table, tr, th, and td): NOTE: Columns are implied by the number of cells in each row (not created with column elements).
  • 6. HTML Table Structure (cont'd) The same table written in code: <table> <tr> <th>Menu item</th> <th>Calories</th> <th>Fat (g)</th> </tr> <tr> <td>Chicken noodle soup</td> <td>120</td> <td>2</td> </tr> <tr> <td>Caesar salad</td> <td>400</td> <td>26</td> </tr> </table> Default browser display:
  • 7. The table Element <table> </table> • Identifies tabular material • Contains some number of row (tr) elements • Optionally, may also have a caption element and row and column group elements
  • 8. Table Row (tr) Element <tr> </tr> • tr stands for “table row.” • The only thing that can go between tr tags is some number of th (header) and td (data cell) elements. • There may be no text content in a row that is not contained within a header or data cell.
  • 9. Table Cells <td> </td> • td stands for “table data.” • Cells can contain any type of web content. • All content in a table must be contained in td tags.
  • 10. Table Headers <th> </th> • th stands for “table header.” • Headers provide information about the cells in the row or column they precede. • They are key tools for making table content accessible. Screen readers may read headers aloud before each data cell, providing context that is missing when you can’t see the table. • Headers are often rendered in a bold font by default.
  • 11. Table Columns Are Implied <table> <tr> <th>Burgers</th> <td>Organic Grass-fed Beef</td> <td>Black Bean Veggie</td> </tr> <tr> <th>Fries</th> <td>Hand-cut Idaho potato</td> <td>Seasoned sweet potato</td> </tr> </table> This table would have 2 rows and 3 columns (because there are 3 cells defined in each row):
  • 12. Spanning Cells Spanning Stretching a cell to cover several rows or columns Column span Stretching a cell to the right over subsequent columns Row span Stretching a cell downward over several rows
  • 13. Column Spans <table> <tr> <th colspan="2">Fat</th> </tr> <tr> <td>Saturated Fat (g)</td> <td>Unsaturated Fat (g)</td> </tr> </table> Notice that the first tr element only has one cell in it now. Every row should have the same number of cells or equivalent colspan values. Use the colspan attribute to specify the number of columns the cell should span over:
  • 14. Row Spans <table> <tr> <th rowspan="3">Serving Size</th> <td>Small (8oz.)</td> </tr> <tr> <td>Medium (16oz.)</td> </tr> <tr> <td>Large (24oz.)</td> </tr> </table> The rowspan attribute to specifies the number of rows the cell spans: Notice that the td elements that were spanned over are no longer in the source.
  • 15. Table Caption <caption> </caption> • Provides a title or description for the table • Improves table accessibility • The caption element must appear first in the table element. • The caption displays above the table by default.
  • 16. Table Caption (cont’d) <table> <caption>Nutritional Information</caption> <tr> <th>Menu item</th> <th>Calories</th> <th>Fat (g)</th> </tr> …table continues… </table>
  • 17. Row and Column Groups • For complicated tables, you can create semantic groups of rows and/or columns that describe the table’s structure. • Row group and column group elements also provide more “hooks” for scripting and styling.
  • 18. Row Groups <thead> </thead> <tbody> </tbody> <tfoot> </tfoot> • Provide additional semantic structure • Row group elements may contain one or more tr elements (no direct text content). • Some browsing agents may repeat the header and footer rows on tables that span multiple pages.
  • 19. Row Groups (cont’d) <table> … <thead> <!-- headers --> <tr></tr> <tr></tr> <tr></tr> <thead> <tbody> <!-- data --> <tr></tr> <tr></tr> <tr></tr> <tr></tr> <tr></tr> <tr></tr> </tbody> <tfoot> <!-- footnote --> <tr></tr> </tfoot> </table> NOTE: this table also utilizes row and column spans.
  • 20. Column Groups <colgroup> </colgroup> <col> </col> • Allows you to assign id and class names to columns so they can be accessed by scripts or styles • colgroup elements go at the start of the table, after the caption element if there is one. • colgroup elements contain no content; they only provide an indication of column structure
  • 21. Column Groups (cont’d) If you need to access individual columns, identify them with col elements: <table> <caption>…</caption> <colgroup></colgroup> <colgroup span="2"></colgroup> <colgroup span="2"></colgroup> <!-- rest of table... --> The number of columns in a group is noted with the span attribute: <colgroup></colgroup> <colgroup> <col class="start"> <col class="end"> </colgroup> <colgroup> <col class="start"> <col class="end"> </colgroup>