Div styles not working in mobile app

Re: Div styles not working in mobile app

by Noel De Martin -
Number of replies: 0
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

> Just an idea: I didn't have a look at how your app loads css styles but couldn't you just load the default app-concerned css-styles after the custom css-file (if the user hasn't booked the premium tier) thus making sure that every alteration is effectively overwritten (!important) afterwards by your defaults?

The way that CSS works, this is not feasible. When styles are applied it's true you can use !important to override other definitions. But then !important could be used in the custom CSS and the most specific selector is applied, regardless of the order in which the css was loaded.

We could also remove !important from the custom CSS file, but that involves parsing and treating CSS. And that is a slippery slope that would create more problems.

Even if we could achieve it somehow, we would end up breaking inline styles because !important also takes precedence over that. It'd be necessary to use !important inline and that's another set problems. That would, for example, break the output generated by TinyMCE which is at the moment one of the few options to style content without being a developer.