Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

How to apply multiple CSS classes to an element?

I have successfully managed to link local .css files to my dash app.

I now want to apply several CSS classes to a single dash_html_elements, e.g.:

  "My title",
  className='header_item main_title',

I have seen that className expects a string argument (see source code on GitHub). I have then space-separated classes (as in standard HTML), but it doesn’t seem to work in my app (I have saved, refreshed, and all). I am not sure whether I do something wrong, or I don’t use the right syntax — I haven’t been able to find the answer on the internet.

Question: How to apply multiple CSS classes to an element?

Happens I had a typo in my dash.Dash(assets_url_path='/…',) setting.

So the answer is: list all your classes in a space-separated string.

1 Like