You can do that by creating a property on the "Home" document type (or a "Settings" type, whichever fits the situation) - either as a simple Textstring accepting a valid CSS color (e.g., "#fff", "lime" or "rgba(0, 255, 0, 0.4)" etc.) - OR - you could use the "Approved Color" data-type and add some sensible prevalues...
Then in the <head> section of your Master Template create a simple <style> element where you output the value as a valid CSS rule. Just remember to add it after any Stylesheets.
You can use a complete macro or some simple Razor code to do the outputting...
I agree about separating stuff, but really - you *could* put the macro on a separate template and use that template as the result of a .css request (remember to set the correct HTTP header), but then you've created an extra HTTP request, which has way more impact on page load time, than a single line of styles.
If you're not planning on making a lot of the CSS "skinnable" in this way, I'd go with the very simple solution...
Macro in Stylesheets... possible?
Does anyone know if it's possible to somehow add proberty values inside stylesheets...
Say for instance you want the end user to be able to set a color code for all links?
How would you do that?
Hi Inmedia,
You can do that by creating a property on the "Home" document type (or a "Settings" type, whichever fits the situation) - either as a simple Textstring accepting a valid CSS color (e.g., "#fff", "lime" or "rgba(0, 255, 0, 0.4)" etc.) - OR - you could use the "Approved Color" data-type and add some sensible prevalues...
Then in the <head> section of your Master Template create a simple <style> element where you output the value as a valid CSS rule. Just remember to add it after any Stylesheets.
You can use a complete macro or some simple Razor code to do the outputting...
/Chriztian
But then it will be internal/inline CSS... I always like to keep my HTML files free of any CSS, keeping it in the external stylesheets.
But it is not possible to add the values directly into the extarnal stylesheets somehow?
But then it will be internal/inline CSS... I always like to keep my HTML files free of any CSS, keeping it in the external stylesheets.
But it is not possible to add the values directly into the extarnal stylesheets somehow?
Hi Inmedia,
I agree about separating stuff, but really - you *could* put the macro on a separate template and use that template as the result of a .css request (remember to set the correct HTTP header), but then you've created an extra HTTP request, which has way more impact on page load time, than a single line of styles.
If you're not planning on making a lot of the CSS "skinnable" in this way, I'd go with the very simple solution...
/Chriztian
Yes, I guess you are right about that.
And I only need the end user to be able to change some standard stuff, like link colors and so... So I will go with the simple solution :)
Thank you for the help ;)
is working on a reply...