Building Dashboards with Dash and Plotly
Alex Scriven
Data Scientist
The 'Box Model' considers each HTML element as a box with layers:
height & width properties)
The border CSS argument takes three elements:
'border':'A B C'solid or dotted)red)
dcc.Graph(figure=ecom_bar,
style={'width':'500px',
'height':'450px',
'border':'5px dotted red'}
)

To set the spacing of an HTML element:
E.g., 'padding':'10px 5px 5px 15px'
$$

No padding:

Adding 'padding':'100px':

No margin:

Adding margin: 100px auto:

With: 'margin':'100px'

With: 'margin':'100px auto'

Elements not aligning? HTML elements can either be 'inline' or 'block' elements.
$$
<div style='width:50px;height:50px;
background-color:blue'></div>
<div style='width:50px;height:50px;
background-color:red
;display:inline-block'></div>
<div style='width:50px;height:50px;
background-color:green;
display:inline-block'></div>
$$

Building Dashboards with Dash and Plotly