Reputation: 132
I am using fill_width=False
, this makes everything in the table visible cramped.
My goal is to add some space to the left and right of the contents in each cell. I am attempting this with the style_cell
and have tried adding both margin and padding, but neither are changing the table.
dash_table.DataTable(
id='tbl1',
columns=[{
'name': f'{j}',
'id': f'{j}',
} for j in datatable_col_names
],
data=[
{f'{j}': '' for j in datatable_col_names}
for j in range(2)
],
export_headers='display',
fill_width=False,
style_cell={'margin-right': '5px', 'margin-left': '5px'}
)
Upvotes: 1
Views: 3382
Reputation: 9786
I think what you want to do is to use padding
instead of margin
:
style_cell={'padding-right': '30px',
'padding-left': '30px'
},
However, I recommend using alignment:
style_cell={'text-align': 'center'},
Upvotes: 2