Search code examples
htmlplotly-dashaltair

Dash - html.P too width when add text


What function can I use in order to add a comment below a html.Iframe plot in Dash?

I am using html.P but this works awful making the plot too width once I add the text.

html.Iframe(id='my-graph', style={'display': 'block', 'width': '400%', 'height': '100%'}),
html.P(id='text-2', children='when I write something here the graph becomes too width.'), 

Additional finding: I noted the issue appears when the text's extension is long.


Solution

  • Set the width of the html.P component to a certain value you'd like under style, like this:

    html.P("Some text", style={"width": "10%"})
    

    Possible width values are explained here