RE: Blazor css overrides

2023-11-30 Thread David Kean via ozdotnet
I just use Chrome's css tools to tell me the order in which things are getting 
evaluated.

From: Greg Keogh via ozdotnet 
Sent: Friday, December 1, 2023 3:51 PM
To: ozDotNet 
Cc: Greg Keogh 
Subject: Blazor css overrides

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 

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/ 

Blazor css overrides

2023-11-30 Thread Greg Keogh via ozdotnet
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 

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/