110 likes | 213 Views
Tables in HTML are used for data output and page layout. Learn about important structures, source code examples, and syntax. Understand attributes and cell properties for effective web publishing.
E N D
Technologies for web publishing Ing. Václav Freylich Lecture 3
Content • Tables in HTML aTNPW1 - 3
Tables • Important structures in web publishing • Used entirely for two dimensional data output • Can be used for making the page layout (old approach to page layout) aTNPW1 - 3
Tables – source code example Source code example <table border="1" cellspacing="0" cellpadding="5"> <caption>Table description</caption> <tr> <td> </td> <th>Annual turnover </th> <th>Growth</th> </tr> <tr> <td>Subsidiary 1</td> <td>6,3 mil</td> <td>+11,5%</td> </tr> aTNPW1 - 3
Tables – source code example <tr> <td>Subsidiary 2</td> <td>+15,2 mil</td> <td>16,7%</td> </tr> <tr> <td>Subsidiary 3</td> <td>4,5 mil</td> <td>-8,5%</td> </tr> </table> aTNPW1 - 3
Tables – output example Output of the previous code: Table description aTNPW1 - 3
Tables – syntax Table<table></table> Table row<tr></tr> Table cell (standard cell)<td></td> Table cell (header cell) <th></th> • Content of this cell is automatically formatted (format depends on the browser) aTNPW1 - 3
Tables – syntax Table caption<caption></caption> • Text description of the table data (optional element) aTNPW1 - 3
Tables – syntax Important table attributes (element<table> ) border … visual border of cells (table grid) cellspacing … space (margin) between the table cells cellpadding … space (padding) between the cell border and the cell content aTNPW1 - 3
Tabulky – syntaxe Important cell attributes (element <td>, <th>) cellspacing … cellpadding … nowrap … affects the content wrapping in the cell colspan … allows merging some cells across the columns rowspan … allows merging some cells across the rows aTNPW1 - 3