Page 133 - CA_165_V2.0_Flipbook
P. 133

The following HTML code uses the <TABLE> tag with the BORDER and BGCOLOR attributes to create a
                 table with a border and background color:

                 <HTML>
                 <HEAD>
                 <TITLE> Working with Table</TITLE>
                 </HEAD>

                 <BODY BGCOLOR = "YELLOW">
                 <TABLE BORDER = "2" BGCOLOR = "Green">
                   <TR>
                                      <TD> DELHI </TD>

                                      <TD> MUMBAI </TD>
                                      <TD> KOLKATA</TD>
                                      <TD> CHENNAI</TD>
                   </TR>

                   <TR>
                                      <TD> INDIA GATE </TD>
                                      <TD> GATEWAY OF INDIA </TD>

                                      <TD> VICTORIA MEMORIAL </TD>
                                      <TD> Fort St. George </TD>
                   </TR>
                 </TABLE>

                 </BODY>
                 </HTML>
                 The output of the preceding HTML code is as follows:

                                                                Table with given background colour.















                         Notes

                         The BGCOLOR attribute of <TABLE> tag is not supported in HTML5.




                 ALIGN Attribute
                 This attribute is used to specify the alignment of the table relative to its surrounding content. The possible
                 values of this attribute are left, right, and center. Syntax to use the ALIGN attribute is as follows:


                                                                                            More About HTML      131
   128   129   130   131   132   133   134   135   136   137   138