Multiple DataTables - header CSS by ID is overwitten

Multiple DataTables - header CSS by ID is overwitten

wallabe123wallabe123 Posts: 24Questions: 13Answers: 0

Test Case: http://live.datatables.net/bewimeqo/1/edit?html,css,js,console,output

I have 5 DataTables that show in individual tabs. If I set the background colour for the table header for all of the tables it works, however if I then go to set the colour for one specific table (using the table ID) it gets overwritten by the DataTables default colour. This happens even with the '!important' attribute added.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955

    I'm not sure I understand the test case. I changed the background and color settings for example2 in this test case and it seems to work:
    http://live.datatables.net/dipoyohu/1/edit

    Maybe I'm not understanding the problem or the test case is not replicating the issue.

    Kevin

  • wallabe123wallabe123 Posts: 24Questions: 13Answers: 0

    @kthorngren hi sorry should have stated, it is working in the linked test case. When I load in the page it sets the header to the correct colour and then changes it to the default DataTables ones, so I'm wondering if I'm missing something. Strange as it works using the HTML tag but not with IDs to specify a table.

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955
    edited June 2022 Answer ✓

    Styling issues are difficult to debug without seeing them. Please provide a link to your page or update the test case to show the issue.

    Try inspecting the affected th to see what styles are provided that might be overriding what you have set or if the CSS is even being applied. That is what we would need to look at to help debug.

    Kevin

Sign In or Register to comment.