Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 45 - CoreGPT(Podar)_Flipbook_C8
P. 45

    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
                         Here, “Name” cell is taking a span of 2 columns. Example for using COLSPAN 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>

                                                                   Working with Lists, Images and Tables in HTML         43

| 40 41 42 43 44 45 46 47 48 49 50 |