HTML Table alignment

Hi,
I was wondering how html.Tbody to align the texts to the right.
I tried to use style = {‘textAlign’ : ‘right’}, but this did not work.
(Also tried writing CSS, but still did not work)

If it were written HTML, it would be

.
How can I implement this in Dash?

Thanks.

1 Like

You’re going to have to use the style_data element instead of just style. Tables have slightly different styling code. check Dash Core Components for them all. below is what you need though.

style_data = {‘text-align’: ‘center’}

This works, until you use “presentation”: “markdown” in your columns. Then the text-align field is ignored, for some reason. This would be ok if you could use ‘

bla

’ in your cells as per the CommonMark specs, but that results in literally printing ‘

bla

’.

Now the docs for dcc.Markdown specify the " dangerously_allow_html" boolean, which I suppose is what prevents inline HTML, but there is no way to switch this on in the columns context, as far as I can see. Any ideas?

Bumping this, anyone?

This is not working. I have the same problem

style={‘margin-right’: ‘auto’,‘margin-left’: ‘auto’} works

But

style={‘text-align’:‘center’} does not

1 Like

I have the same issue.

I want to set to the right align, but it does not work at all