Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

dcc.Markdown - style/margin adjustment?

When enterring a dcc.Markdown component in dash, can margins or other style properties be set? The default is a 10px bottom margin and 0px top margin…What are our options if we want to change those?

Thanks,

Not sure if you can do it inside dcc.Markdown but you can change it in the Div like this:

html.Div([
        dcc.Markdown('''Your text'''),
        ], 
        style={'marginLeft': 10, 'marginRight': 10, 'marginTop': 10, 'marginBottom': 10, 
               'backgroundColor':'#F7FBFE',
               'border': 'thin lightgrey dashed', 'padding': '6px 0px 0px 8px'}),

Thanks, but that just wraps the <p> tag that ultimately contains the markdown content in another div, and that style property affects the div. the <p> tag is where the margin is set, so the margin is still there…

I ended up just using html.P and styling that…

2 Likes