Media queries in Python


I was wondering how to implement media queries in Python Dash. For example in my Dash app with mutliple divs, I have a div called “first_row” with a row-reverse flex-direction and, if my screen width goes under, let’s say, 500px, I want it to go column-reverse. How can I do it?

I guess it might look like that but I have absolutely no idea about the grammar in Python:
@media only screen and {“max-width” : 500} {
“id” = “first_row” ==> “flex-direction” : “column-reverse”;

Of course the “==>” is not Python at all but I guess you’ll understand it!


PS: I hope I respect all the rules of this forum but as I am new to it, I may have forgotten to do something, sorry if it is the case! :wink:

good question! it’s not possible to specify media queries, or any css selector, in the python syntax. you’ll just have to use css instead by placing a file in a folder named assets/

Thanks for your reactivity! I’m closing the topic then (if I find how to do this)