Page 119 - TP_iPlus_V2.1_Class7
P. 119

Using Width Property

                 The width property is used to specify the width of a box or table. 100% width will capture the
                 complete width of the web page. For example:

                 <style>

                     table{width:50%}
                 </style>

                 Using Padding Property

                 The padding property is used to specify the space around the content of a cell and the border of
                 the cell in a table. For example:

                 <style>

                 table, th, td                                                             Table : Student
                 {
                                                                                 Roll No.     Name  Grade  Gender
                     border:2px;
                                                                                 1        Aarav    B      M
                     border-style:solid;
                                                                                 2        Gauransh  A     M
                     border-color:green;
                                                                                 3        Himakshi  A     F
                     border-spacing:15px;
                                                                                 4        Rakshit  B      M
                     padding:15px

                 }
                 </style>

                 Using Background-color Property

                 The background-color property is used to specify the colour for the background in a table on the
                 web page. You can apply colour in a cell, row or entire table. For example:

                  <style>

                 table, th, td
                 {

                     border:2px;
                     border-style:solid;

                     border-color:green;
                                                                    Table : Student
                     background-color:orange;                Roll No.    Name  Grade Gender
                                                             1      Aarav    B     M
                 }
                                                             2      Gauransh A     M
                 </style>                                    3      Himakshi A     F
                                                             4      Rakshit  B     M






                                                                                                                 117
                                                                                        Lists and Tables in HTML
   114   115   116   117   118   119   120   121   122   123   124