How do we specify whether a header cell is a header for a column, row, or group of columns or rows in HTML?


Use the scope attribute to implement whether a header cell is a header for a column, row, or group of columns or rows in HTML −

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
            border: 1px solid black;
         }
      </style>
   </head>
   
   <body>
      <h2>Cricketers</h2>

      <table style = "width:100%">
         <caption>Indian Cricketers</caption>
         <th></th>
         <th scope = "col">Name</th>
         <tr>
            <td>1</td>
            <td>Sachin Tendulkar</td>
         </tr>
         <tr>
            <td>2</td>
            <td>Virat Kohli</td>
         </tr>
      </table>
   </body>
   
</html>

Updated on: 30-Jul-2019

59 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements