Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi everyone,
I would like to change the colors of my scheme using a property. I have the property defined (which works), but how can I call this property in the CSS file? Everything I tried didn't work. Or is there any other way to achieve this?
Hello @tungdo,
it is not possible to reference C# data in a css file.
What you can do is to use your Umbraco doc type property to specify a class name which then is added to an html element in your view file.
So when your css files looks like this:
.colorSchemeLight { color: black; background-color: white; } .colorSchemeDark { color: white; background-color: black; }
and your doc type property of type string is called myCssClassNameProperty, you can reference this in your .cshtml like
string
myCssClassNameProperty
.cshtml
<div class="@Model.myCssClassNameProperty">
If you use a Radio button list as your property editor, then you can predefine the available values so only valid class names can be chosen.
Hope this helps!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Changing CSS variables in a property
Hi everyone,
I would like to change the colors of my scheme using a property. I have the property defined (which works), but how can I call this property in the CSS file? Everything I tried didn't work. Or is there any other way to achieve this?
Hello @tungdo,
it is not possible to reference C# data in a css file.
What you can do is to use your Umbraco doc type property to specify a class name which then is added to an html element in your view file.
So when your css files looks like this:
and your doc type property of type
string
is calledmyCssClassNameProperty
, you can reference this in your.cshtml
likeIf you use a Radio button list as your property editor, then you can predefine the available values so only valid class names can be chosen.
Hope this helps!
is working on a reply...