Search code examples
cssantdant-design-pro

How to change background color of table head(thead) and text color in `antd` table?


Please explain me how to change background color of table head(thead) and text color in antd table (antd ui library)


Solution

  • you can change header colour by overriding table header class (you will get all the element classes from developer tool) for header class

    .ant-table-thead>tr>th{
       background:#fdfdfd
    }
    

    as a result it will override the color globally to override the color for specific table only just wrap the table in some div by giving class "test" and override the css

    .test .ant-table-thead>tr>th{
       background:#fdfdfd
    }
    

    and it will update the color for specific table head only

    same for the text color as well.

    .ant-table-row{
    color:red
    }