
I recall doing something similar in the past but I believe I gave each client their own entire css. So app.css by default OR use the client’s css if the config value is passed (via querystring or whatever). I don’t see a problem with using !important if it guarantees it and they do it always. If they don’t want to then the alternative above may suit. I’ve never bothered going down the rabbit hole of css to be honest. On Fri, 1 Dec 2023 at 15:53, Greg Keogh via ozdotnet <ozdotnet@ozdotnet.com> wrote:
Folks, TGIF
Our Blazor app has a simple classic shape with a local wwwroot/app.css file containing all the styles for the app. I had to allow people to customise the appearance, and my way of doing that works, but not as smoothly as I hoped and I think someone might be able to suggest a better more elegant technique.
If someone starts the app with query parameter ?t=contoso then the startup code appends a line like this into the <head>
<link rel="stylesheet" type="text/css" href="https://*somecompany*. blob.core.windows.net/*myapp*/*contoso.css*">
They can edit this external css file and override selectors without touching the original app's files. Firstly ... is this sensible? It works, but there is a problem.
To override a certain colour they have to code something like this:
.HeadLinkSel { background-color: BlueViolet !important; }
Note how the !important is needed, sometimes. I can't figure out why yet, but !important needs to be added to the overrides most of the time. I thought that the last selector override all previous identical ones, and it's really irritating and confuses people settings the overrides. Can anyone explain this?
Maybe my whole technique is flawed and naïve. I'm keen for suggestions or links to recommended techniques for doing this sort of thing.
Cheers, *Greg Keogh* -- ozdotnet mailing list To manage your subscription, access archives: https://codify.mailman3.com/