Reputation: 607
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 ?
Upvotes: 2
Views: 10179
Reputation: 58637
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)
Upvotes: 6