Mister @hotNipi,
You have no clue how much I appreciate your css for dummies explanation...
Thanks !!! Very illuminating!!
Now my shrinken brain needs to digest it slowly...
After reading your feedback, there are a couple of things that I don't understand now:
-
You apply a fill style color yellow, which seems to be more specific than all other styles, so the path becomes yellow. However in our original issue at the time being, our fill color style on the path element was overridden by the dashboard . So that is another behaviour as in your example...
Does that make sense to you? -
Steve and Dave solved it (at the time being) by following workaround:
- added class
ui-svg
to the parentdiv
of thesvg
- added a local
<style>
element to override some style settings:
div.ui-svg svg{ color: var(--nr-dashboard-widgetColor); fill: currentColor !important; } div.ui-svg path { fill: inherit !important; }
So if I understand correctly: when no fill style color is applied to the path by the user then the fill color value will be inherited from the div style. And the div style will in turn use the currentColor (I assume that is something from the dashboard) as color. Is that a bit correct? And that solves the problem from step 1 since this rule is more specific, compared to the dashboard rule (since we target specifically only on the div.ui-svg class), so this rule wins? Correct?
- added class
-
The solution from step 2 has worked for a long time. To have scoped css , I applied that postcss-prefix-selector to all the rules in the CSS tabsheet. So the default content:
Will become this:
That way the styles are only applied to this SVG drawing only. Which works fine, as you can see in this simple example.
But it seems that my prefixes have corrupted the solution from Steve and Dave somehow. However I don't understand why, because my prefixes make the style much more selective compared to the dashboard styles? But seems not
And when the users remove the
important!
keywords, then suddenly everything works again...
My wife always tells me I need to search a more relaxing hobby...
I am getting an idea of what she means
Really appreciate your help!! And (most...) SVG node users also!!