homepage Welcome to WebmasterWorld Guest from 54.161.220.160
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
different css for one page only and .net
designer123

5+ Year Member



 
Msg#: 3574538 posted 5:55 am on Feb 14, 2008 (gmt 0)

Guys I am having below CSS in the head tag of an aspx file which I want to use only for one particular page in the site. If I put this code in master page in .net then it will be applied to all site pages which I do not want. How do I make the below css work only for one particular page. That page is having the body id = “mainpage”

<style type="text/css">
@media screen
{
* html
{
overflow-y: hidden;
width:90%;
z-index:-1000;
}
* html body
{
height: 84%;
overflow:auto;
margin:0px;
z-index:-1001;
}
}
table#header
{
margin-top:-90px !important;
background-color:#FFF;
z-index:1000;
margin-left:0 !important;
}

.fixedelement
{
position:fixed !important;
_position:relative !important;
_top:0px !important;
_z-index:5000;
}
</style>

Html –
<div class="fixedelement"></div>

 

SuzyUK

WebmasterWorld Senior Member suzyuk us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3574538 posted 8:23 am on Feb 14, 2008 (gmt 0)

That page is having the body id = “mainpage”

That makes most of your answer nice and easy you should simply insert the body ID into all the rules (in their place in the tree) this is called "specificity" in other words you are going to make those rules so specific they will only apply to pages with that ID in them.

* html body#mainpage
#mainpage table#header
#mainpage .fixedelement

You have however a rule for the <html> element, * html, which you cannot target this way as you cannot target parents based on their children - the <body> with the ID is a child of the <html>

so if it's important to target that rule, is it possible you can put pages unique ID's onto the <html> element instead - or if there are wrapper divs already in place move everything down a level in the code?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved