Bygg dashboards med Dash och Plotly
Alex Scriven
Data Scientist
$$
De flesta webbplatser använder CSS-filer;
style istället
CSS kan även användas på ett HTML-element
style på en tagg"property:value; property:value;"

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

Vi kan redigera CSS direkt på en live-webbplats

Dash-komponenters argument style
Tidigare kod i en Dash-komponent:
app.layout = [
html.H1('Welcome to the website!'),
html.H2('Text',
style={'font-size':'50px',
'color':'red'})
]
CSS kan användas för att ange:
background-color)color)
Båda metoderna tar emot strängar (t.ex. 'red') eller RGB-koder (t.ex. är 'rgb(0,0,255)' blått!)

CSS kan ange storlek via egenskaperna width och height
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%'})
]
Bygg dashboards med Dash och Plotly