Referencing css locally

how do you reference css from the file path of your dash app?

I used the vanguard code and ran it from the desktop locally.

external_css = ["https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css",
            #"https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css",
            "\css\normalize.css",
            "//fonts.googleapis.com/css?family=Raleway:400,300,600",
            "https://codepen.io/bcd/pen/KQrXdb.css",
            "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"]

i have a “css” folder in the same directory as app.py

https://dash.plot.ly/external-resources

Try to locate the stylesheet to .\venv\Lib\site-packages\dash_core_components\stylesheet.css

And then add following code:

import dash_core_components as dcc

dcc._css_dist[0]['relative_package_path'].append('stylesheet.css')

Please do not do this. This is not in the official API and things that are not in our official API will break. It will also not work when you upgrade your dash-core-components package and we publish releases very often (see Installation | Dash for Python Documentation | Plotly for the latest version)

Please use the official solution in our official docs here: Adding CSS & JS and Overriding the Page-Load Template | Dash for Python Documentation | Plotly

1 Like

@chriddyp Thanks for your reminder. :grinning: I was using dash 0.21 and now going to upgrade to the latest version.