I have a css called styles in my static folder
styles.css
and this is how I call in my script the css
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP,dbc.icons.BOOTSTRAP])
how do I map this style.css to the external_stylesheets? (I need to do this)
Hi @topotaman
If you place styles.css
in a folder called assets
dash will automatically include it. Note that you also need to include __name__
when you instantiate the app:
app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP,dbc.icons.BOOTSTRAP])
See more info here:
New in dash v0.22.0! Learn how to add custom CSS and JS to your application with the assets` directory. Also, learn how to customize the HTML template that Dash serves on page load in order to add custom meta tags, customize the page's title, and...
I know dash works with the static foldier… but this q is because I deployed the app in the web, and need to map the css (and dont know how to map it in dash)
You can directly map the url in the external_stylesheets section. Hopefully this will solve the issue for you.
@jinnyzor hi, can you do an example please? (this might be usefull for others)
Sure thing.
app = dash.Dash(name , external_stylesheets=[dbc.themes.BOOTSTRAP,dbc.icons.BOOTSTRAP, ‘http://linktoyourstylesheet ’])
You can also do the same thing with external scripts.
works! check out my web app www.pokerutils.com
2 Likes