Two lines in html table header


I am using below dash code taken from dash user guide to generate html table from dataframe.

My table has multindex columns. Table header using this code giving merged header. E.g if level 0 is ‘Word’ and level 1 is ‘Count’ then the header is ‘Word Count’. I want to see it in two lines. I tried changing columns to Word
Word \n Count, Word html.Br() Count. Did not get success. My html knowledge is limited. Any help will be appreciated.

Thank you.

def generate_html_table_from_df(df):
return html.Table(


[html.Tr([html.Th(col) for col in df.columns])] +


html.Td(df.iloc[i][col], style={‘padding-top’:‘2px’, ‘padding-bottom’:‘2px’,
‘text-align’:‘right’}) for col in df.columns
]) for i in range(len(df))], style={‘border’:‘1px’, ‘font-size’:‘1.2rem’}