Page 51 - Modular_V1.1_Flipbook
P. 51

Here, “Name” cell is taking a span of 2 columns. Example for using ROWSPAN attribute is:

                      <TD COLSPAN="2">
                      VALIGN: The VALIGN attribute is used to align the position of text in the cell vertically, that
                      is, vertical alignment. It can take any one from three values, “top”, “middle” and "bottom".
                      This is useful when a text has to be aligned in case of rowspan. Consider the table with
                      rowspan (previously used), the text “Sports” appears to be in the middle and “Martial Arts”
                      at bottom vertically with respect to the Types column.

                     ATTRIBUTES OF THE <TR> TAG

                 The <TR> stands for Table Row, which is used to starts a row and ends up with </TR>. It is a
                 container tag. All the attributes discussed with <TD> tag can also be used with the <TR> tag

                 except the ROWSPAN and COLSPAN attributes.
                     HTML CODE TO CREATE A TABLE

                 Let us create a table using the <TABLE> tag.

                 <HTML>
                 <HEAD> <TITLE> Students of Class </TITLE>
                 </HEAD>
                 <BODY>
                     <TABLE BORDER="1" BORDERCOLOR="RED">

                         <CAPTION> <B> Table : Student </B> </CAPTION>
                         <TR BGCOLOR="lightgreen">
                            <TH> Roll No. </TH>
                            <TH> Name </TH>
                            <TH> Grade </TH>
                            <TH> Gender </TH>
                         </TR>
                         <TR>

                           <TD> 1 </TD>
                           <TD> Aarav </TD>
                           <TD> B </TD>
                           <TD> M </TD>
                        </TR>
                        <TR>

                           <TD> 2 </TD>
                           <TD> Gauransh </TD>
                           <TD> A </TD>
                           <TD> M </TD>
                        </TR>
                        <TR>



                                                                                                 Tables in HTML   49
   46   47   48   49   50   51   52   53   54   55   56