In a section of my site I want to create pages with results from competetions and those are usually with a lot of styling, tables etc in them and I would like the content not to be affected by the MasterPages CSS file at all. Is there any way to do this or do I have to create a new master template from scratch for those pages?
Tom Hare has a good solution. But if you still need parts of your master CSS, you could add class or IDs to the objects that you want to specify the CSS, and them set new style. If I'm not making a mistake, those CSS style should have priority over general CSS style. Or last solution : you can split your master CSS file.
Just put the CSS link HTML into a ContentPlaceHolder and then "blank it out" in the template you don't want to use it in by adding a Content tag. Remember, a Content tag replaces the content within a ContenPlaceHolder, and that includes blank content.
For example, if you had this in your main master template:
You could remove the <link rel="stylesheet" ... /> in any child template that inherits from the master by placing an empty asp:Content holder that references the ContentPlaceHolder id:
Prevent CSS to be applied to some custom content
Hi,
In a section of my site I want to create pages with results from competetions and those are usually with a lot of styling, tables etc in them and I would like the content not to be affected by the MasterPages CSS file at all. Is there any way to do this or do I have to create a new master template from scratch for those pages?
Thanks,
Stefan
Hi Stefan,
I guess you could wrap the <link> tag for your master CSS file in an if statement and tell it to exclude the appropriate page/document type/template?
Tom
Tom Hare has a good solution. But if you still need parts of your master CSS, you could add class or IDs to the objects that you want to specify the CSS, and them set new style. If I'm not making a mistake, those CSS style should have priority over general CSS style. Or last solution : you can split your master CSS file.
Just put the CSS link HTML into a ContentPlaceHolder and then "blank it out" in the template you don't want to use it in by adding a Content tag. Remember, a Content tag replaces the content within a ContenPlaceHolder, and that includes blank content.
For example, if you had this in your main master template:
You could remove the <link rel="stylesheet" ... /> in any child template that inherits from the master by placing an empty asp:Content holder that references the ContentPlaceHolder id:
<asp:Content ContentPlaceHolderID="ContentPlaceHolderHead" runat="server" />
is working on a reply...