Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How I use Css only in master page and the content page must not use it
Posted

For that you have to use only class selector . Apply classes only to those controls which you want , Other controls automatically will be excluded to that css class.
 
Share this answer
 
Create two different CSS files.
One for Master Page & another one for Content page.

Make sure. both the CSS have different CSS classes.

-KR
 
Share this answer
 
You need to design the page in that way. Define css classes which are also used in Master Page and not in content pages.
 
Share this answer
 
You can use Id instead of class for this.

As Id are supposed to be uniqe in DOM, so any css applied to that control id present in master page, will only be added to that id and not to the content pages.

CSS
#myMasterPageControl { color: red; }
.myChildPageControl { color: green; }


Div in master page:

HTML
<div id="myMasterPageControl">Some Text</div>


Div in content pages:

HTML
<div class="myChildPageControl">Some Text</div>
<div class="myChildPageControl">Some Text</div>
<div class="myChildPageControl">Some Text</div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900