Search code examples
htmlcsscss-tables

How to make first row and all columns transparent in css?


How to write code for this using HTML and CSS. Table

Please note that first row and columns in first row are transparent


Solution

  • table {
        border-collapse: collapse;
    }
    
    th {
        height: 6rem;
        width: 6rem;
        text-align: left;
    }
    
    .background {
        background-color: lightgrey;
    }
    
    tr {
        height: 6rem;
        width: 6rem;
    }
    
    td {
        border: 1px solid lightgrey;
        border-collapse: collapse;
    }
    <table>
          <tr>
            <th>A</th>
            <th>B</th>
            <th>C</th>
            <th>D</th>
          </tr>
          <tr class="background">
            <td>9</td>
            <td>9</td>
            <td>9</td>
            <td>9</td>
          </tr>
          <tr>
            <td>4</td>
            <td>4</td>
            <td>4</td>
            <td>4</td>
          </tr>
         </table>