Do you want CSS on certain pages or across the entire college site?
I think you mean want the entire site to have the css but use the same master template? I would add a drop down "CssSelection" at the root homepage node - here I've called the values Css1 .. Css3 but you should name them the same as the corresponding CSS files for the colleges.
In your template you can "get" this node and check the value to decide which CSS file reference to output. E.g.
@{
var home = Model.Content.AncestorOrSelf("1");
var css = home.GetPropertyValue<string>("cssSelection");
string cssFileLocation = "/css/" + css + ".css";
<link rel="stylesheet" type="text/css" href="@cssFileLocation" />
}
How to apply Dynamic CSS in Umbraco page ?
[22-11-2017 14:20] Nirav Panchal: Hi,
I have created single web page in umbraco. I want to apply dynamic css on the page.
Suppose we have 3 College :
College A, College B, College C : having their own css.
So according to the selection it will apply the css.
So how could I do it with my project ?
Can anyone help me ? now ?
Hi,
Do you want CSS on certain pages or across the entire college site?
I think you mean want the entire site to have the css but use the same master template? I would add a drop down "CssSelection" at the root homepage node - here I've called the values Css1 .. Css3 but you should name them the same as the corresponding CSS files for the colleges.
In your template you can "get" this node and check the value to decide which CSS file reference to output. E.g.
HTH
Steve
Thank you Steve
is working on a reply...