Black Lives Matter. Please consider donating to Black Girls Code today.

Adding local css in Dash - with Windows

Hello everybody,

I would like to use a local css in my dash app. I followed the steps explained in the dash documentation, section "Adding Your Own CSS and JavaScript to Dash Apps".

When I try it out in my Linux environment with Firefox, it works perfectly fine as expected.
Then I tried it under Windows, the result was ugly (I made the try with IE, Firefox, and Chrome).

A glance at the html source code shows that in the case of Windows, there was no link in the header pointing to the css file, while I got it in my Linux browser:

Windows :

    <!DOCTYPE html>
            <meta charset="UTF-8">

Linux :

    <!DOCTYPE html>
             <meta equiv="X-UA-Compatible" content="IE=edge">
             <meta charset="UTF-8"/>
             <link rel="stylesheet" href="/assets/header.css">
             <link rel="stylesheet" href="/assets/typography.css">

Does anyone have a hint on what I may be doing wrong, or if this is something that needs to be corrected in a next Dash release ?

Thank you for your help. The answer “don’t use Windows” is not what I expect :blush:

I think you need to have the CSS files lying in the dash-core-components package folder.

Windows user here. Local CSS works fine for me, I do like this:


And have the CSS files in a folder named ‘css’ the following path:
Which is my path to my dcc package.

Please do not do this. This is not a stable API, it will break in the future!

The official instructions in are the recommended way to do this. It should work on Windows, in fact the feature was developed on a windows machine.

From the looks of it, it looks like you’re windows version of dash might be old? <meta equiv="X-UA-Compatible" content="IE=edge"> was added in and definitely isn’t OS dependent.
Upgrade with:

pip install dash --upgrade

Thank you both for your help. Chris got it right, even though I installed dash not so long ago, upgrading my windows version fixed the issue. It’s a relief to see that the easy way described in the documentation works everywhere and that there is no need for fancy tricks :slight_smile:



Guess I need to take the upgrade step, fingers crossed, as well. :grimacing: