Page 121 - C_GPT _V4 _class_7
P. 121

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;

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






                                                                                        Lists and Tables in HTML5  119
   116   117   118   119   120   121   122   123   124   125   126