Page 53 - DCAP202_Fundamentals of Web Programming
P. 53

Fundamentals of Web Programming




                    Notes          5.1 HTML Tables

                                   Tables are defined with the <table> tag. A table is divided into rows (with the <tr> tag), and each
                                   row is divided into data cells (with the <td> tag). The letters td stands for “table data,” which is
                                   the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal
                                   rules, tables, etc.

                                          Example:
                                   <table  border=”1">
                                   <tr>
                                   <th>Heading</th>
                                   <th>Another  Heading</th>
                                   </tr>
                                   <tr>
                                   <td>row  1,  cell  1</td>
                                   <td>row  1,  cell  2</td>
                                   </tr>
                                   <tr>
                                   <td>row  2,  cell  1</td>
                                   <td>row  2,  cell  2</td>
                                   </tr>
                                   </table>
                                   Output
                                     Heading  Another Heading
                                    row 1, cell 1   row 1, cell 2
                                    row 2, cell 1   row 2, cell 2

                                   Self Assessment


                                   Fill in the blanks:
                                   1.  Tables are defined with the ........................... tag.
                                   2.  The letters ........................... stands for “table data,” which is the content of a data cell.
                                   3.  A ........................... can contain text, images, lists, paragraphs, forms, horizontal rules, tables,
                                       etc.
                                   4.  A table row is define by ........................... tag.

                                   5.2 Creating Tables


                                   The basic structure of an HTML table consists of the following tags:
                                      Table tags: <TABLE> </TABLE>
                                      Row tags: <TR> </TR>
                                      Cell tags: <TD> </TD>
                                   Constructing an HTML table consists of describing the table between the beginning table tag,
                                   <TABLE>, and the ending table tag, </TABLE>. Between these tags, you then construct each row
                                   and each cell in the row. To do this, you would first start the row with the beginning row tag,


          46                                LOVELY PROFESSIONAL UNIVERSITY
   48   49   50   51   52   53   54   55   56   57   58