Skip to content
Advertisement

css for a specific table header

I have a table implemented using a third party library. There i have something like the below code when inspecting the elements.

<th class="" colspan="3">
   <span class="ant-table-header-column">
      <div>
          <span class="ant-table-column-title">
             GENERAL
          </span>
          <span class="ant-table-column-sorter"></span>
      </div>
   </span>
 </th>



<th class="" colspan="2">
       <span class="ant-table-header-column">
          <div>
              <span class="ant-table-column-title">
                 INFORMATION
              </span>
              <span class="ant-table-column-sorter"></span>
          </div>
       </span>
     </th>

I want to write a css class for th where colspan="3" . The colspan="3" part is the only difference between the code blocks. How do i write a custom class to override the css properties from the library?

Advertisement

Answer

Use an attribute selector:

th[colspan="3"] {
   ...
}
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement