dbc.Table and html.Div have different backgrounds

Hi @cosco

This was a little tricky - the color prop in the Table can’t use arbitrary colors - only the named Bootstrap colors such as “primary”, “secondary” etc. If you inspect the browser, you will see that Bootstrap has some other custom styling for the table, including this accent color for the background:

Here’s how to over-ride it:

RatioTable = dbc.Table.from_dataframe(
    df,
    hover=False,
    responsive=False,
    striped=False,
    # color="#191919"
    style={"--bs-table-accent-bg": "unset"},
)
2 Likes