-1

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?

1
  • 1
    There is no direct :not selector in CSS for attributes such as colspan. However, you can use the :not() pseudo-class in conjunction with an attribute selector to achieve the effect you want. Commented Aug 22, 2024 at 12:53

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

@AyhanYüce No need for comments that say "thank you"; instead, follow the guidance in the help center on what to do when someone answers your question
1

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>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.