Is there any way to add borders to the table. What should I add to the following code.
html.Table(className='reaponsive-table',
children=[
html.Thead(
html.Tr(
children=[html.Th(col.title()) for col in imp_df.columns.values]
)
),
html.Tbody([
html.Tr(
children=[html.Td(data) for data in d]
)
for d in imp_df.values.tolist()])
])
Hi,
Dash generate HTML, and as you have a class ‘reaponsive-table’, you can simply add CSS to it. See for instance the following CSS:
.reaponsive-table {
border: solid;
}
.reaponsive-table td {
border: solid;
border-width: 0.2px;
}
.reaponsive-table tr:hover {
background-color: yellow;
}
.reaponsive-table td:hover {
background-color: red;
}
It produces the following table:
To include CSS, see the docs: https://dash.plot.ly/external-resources
GwendalD
2 Likes
Hey! Thanks a lot. It worked well.
1 Like