skip to Main Content

We can use attribute selector like that td[colspan]. But I need to use selecting "not colspan". Can you help me?

I tried td[not:colspan] but it is not working. I tried in FrameworkJS but it is not working.

How to select CSS attribute selector?

2

Answers


  1. You can use td:not([colspan]) selector in your code.

    Login or Signup to reply.
  2. You were almost there.

    td:not([colspan]) 
    
    td {
      border: 1px solid red;
    }
    
    td:not([colspan]) {
      background: lightblue;
    }
    <table>
      <tr>
        <th>Month</th>
        <th>Savings</th>
      </tr>
      <tr>
        <td>January</td>
        <td>$100</td>
      </tr>
      <tr>
        <td>February</td>
        <td>$80</td>
      </tr>
      <tr>
        <td colspan="2">Sum: $180</td>
      </tr>
    </table>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search