Set the number of columns to span in HTML

HTMLWeb DevelopmentFront End Technology

Use the span attribute to set the number of columns to span in HTML. You can try to run the following code to implement span attribute −

Example

<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
            border: 1px solid black;
         }
      </style>
   </head>
   <body>
      <table>
         <colgroup>
            <col span = "1" style = "background-color:grey">
         </colgroup>
         <tr>
            <th>S.NO</th>
            <th>Name</th>
         </tr>
         <tr>
            <td>1</td>
            <td>Amit</td>
         </tr>
      </table>
   </body>
</html>
raja
Published on 14-Mar-2018 10:56:04
Advertisements