2

I know how to add a background image to a plotly graph object, however, is it possible to add background image for html.Div or html.H1 ?

1 Answer 1

6

Here is a working example demonstrating how to add a background-image using inline styles.

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from pandas_datareader import data as web
from datetime import datetime as dt
import plotly.graph_objs as go

app = dash.Dash()
app.layout = html.Div(children=[
    html.H1('Hello Dash', style={'background-image': 'url(https://upload.wikimedia.org/wikipedia/commons/2/22/North_Star_-_invitation_background.png)'})
    ])

if __name__ == '__main__':
    app.run_server(debug=True)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.