Page 50 - Modular_V1.1_Flipbook
P. 50

ATTRIBUTES OF THE <TD> TAG

                  The <TD> tag stands for Table Data. It is used to fill the data in the table cells. Following are the
                  attributes used to present the cell or table data in more effective manner:

                       ALIGN: The ALIGN attribute is used to set display position of the text in a cell horizontally,
                       that is, horizontal alignment of the text. It can take any one of the following four values:
                        “justify” – straches the content so that each character has equal width.
                        “center” – to align text to the center of the cell.

                        “left” – to align text to the left edge of the cell.
                        “right” – to align text to the right edge of the cell.

                         For example,
                                <TD ALIGN="center">

                       BGCOLOR: The BGCOLOR attribute is used to give background color to an individual cell
                       wherever it is specified. For example,
                         <TD BGCOLOR="Pink">

                       WIDTH: The WIDTH attribute defines width of an individual cell when specified either in
                       pixels or in percentage of table width. For example,

                         <TD WIDTH=30> or <TD WIDTH=40%>
                       In the same way, you can use the HEIGHT attribute.
                       ROWSPAN: The ROWSPAN attribute applies when a single cell is extended for more than a
                       single row, that is, the cell spans for 2 or more rows instead of 1 as shown in below table.

                                                  Category                    Types

                                                                      Badminton
                                           Sports                     Football

                                                                      Basketball
                                                                      Judo
                                           Martial Arts               Karate

                                                            Table with rowspan
                       Here, the cell “Sports” is taking a span of 3 rows and “Martial Arts” is taking a span of 2 rows.
                       Example for using ROWSPAN attribute is:

                         <TD ROWSPAN="3">
                       COLSPAN: The COLSPAN attribute applies when a single cell is extended to more than a

                       single column, that is, the cell spans for 2 or more columns instead of 1 as shown in table below:

                                    Roll No.              Name                 Marks        Grade
                                                    First         Last


                                                            Table with colspan


                  48      Touchpad MODULAR (Version 1.1)-IX
   45   46   47   48   49   50   51   52   53   54   55