Building Dashboards with Dash and Plotly
Alex Scriven
Data Scientist
$$
Most websites have CSS files;
style property instead
CSS can also be used on an HTML element
style property of a tag"property:value; property:value;"

<h1>Welcome to the website!</h1>
<h2 style="font-size:50px;color:red">
Enjoy your stay!
</h2>

We can edit some CSS on a live website

Dash components style argument
Previous code in a Dash component:
app.layout = [
html.H1('Welcome to the website!'),
html.H2('Text',
style={'font-size':'50px',
'color':'red'})
]
CSS can be used to set the:
background-color)color)
Both methods accept strings (e.g., 'red') or RGB codes (e.g., 'rgb(0,0,255)' is blue!)

CSS can set the size via the width and height properties
app.layout = [
# Add & resize the company logo
html.Img(src=logo_link,
style={'width':'250px', 'height':'250px'})
]
app.layout = [
# Add & resize the company logo
html.Img(src=logo_link,
style={'width':'50%', 'height':'50%'})
]
Building Dashboards with Dash and Plotly